package com.shopping.action;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;import com.shopping.actionForm.orderForm;
import com.shopping.dao.orderDao;import java.sql.*;
public class orderAction extends Action {
private orderDao orderdao ;

public orderAction() {
orderDao dao=new orderDao();
this.orderdao = new orderDao();
}
/************************执行方法****************************/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String action = request.getParameter("action");
if(action == null) {
request.setAttribute("error", "action为空");
System.out.println("action参数为空");
return mapping.findForward("error");
//以订单编号查询
} else if("selectonebynumber".equals(action)) {
return orderselect(mapping,form,request,response);
//删除订单
} else if("delete".equals(action)) {
return orderDelete(mapping,form,request,response) ;
} else {
return mapping.findForward("error");
}

}
package com.shopping.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;import com.shopping.actionForm.orderForm;
import com.shopping.actionForm.orderForm;
import com.shopping.core.DB;public class orderDao {


/**************************************查询******************************/

public orderForm selectone(String number) {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
orderForm orderform=null;

String sql = "select * from tb_order where number = '"+number+"'";

int flag=0;
try {
conn = DB.getConn();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
while(rs.next()) {
    orderform=new orderForm();
    orderform.setId(Integer.valueOf(rs.getString("id")));
    orderform.setAdress(rs.getString("address"));
    orderform.setMemberid(Integer.valueOf(rs.getString("memberid")));
    orderform.setNumber(Integer.valueOf((rs.getString("number"))));
    orderform.setSetmoney((rs.getString("money")));
    orderform.setState(Integer.valueOf(rs.getString("state")));

}
} catch(SQLException e) {
e.printStackTrace();
} finally {
DB.close(rs);
DB.close(stmt);
DB.close(conn);
}
return orderform;
}

<struts-config.xml>
<action path="/admin/orderAction"
            type="com.shopping.action.orderAction"
            scope="request"
          name="orderForm">
          <forward name="orderselectone" path="/admin/order_oneresult.jsp"></forward>
          <forward name=""  path=""> </forward>
          <forward name="" path=""> </forward>
          </action>

解决方案 »

  1.   

    忘贴了 HTTP Status 404 - /shopping/admin/orderAction--------------------------------------------------------------------------------type Status reportmessage /shopping/admin/orderActiondescription The requested resource (/shopping/admin/orderAction) is not available.
      

  2.   

    路径写错了啊,你是从一个模块转到另一个模块还是就在shopping模块中请求这个action?
      

  3.   

    shopping是系统的名字,这是订单查询功能,输入订单号后按确定,在新的页面中显示结果
      

  4.   

    404,没有找到请求的资源,好好看看自己的路径,注意区分web应用路径和域名访问路径。
      

  5.   

    配置没问题,jsp路径写错了。
    form就直接 <form action="/admin/orderAction.do">
      

  6.   

    action的配置错误,或者访问的地址不对