⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modifyorderaction.java

📁 网上商城
💻 JAVA
字号:
package store;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
public class ModifyOrderAction extends Action {
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
  HttpSession session=request.getSession();
  DynaActionForm tform=(DynaActionForm)form;
  ActionErrors errors=new ActionErrors ();
  String action=(String)tform.get("action");
  String orderid=(String)tform.get("orderid");
  int order=Integer.parseInt(orderid);
  String oid=(String)tform.get("oid");
  String quantity=(String)tform.get("quantity");
  String delivery=(String)tform.get("delivery");
  String payment=(String)tform.get("payment");
  try{
   ModifyOrder MO=new ModifyOrder();
   boolean flag=false;
   if(action.equals("1")){
     int id=Integer.parseInt(oid);
     int qu=Integer.parseInt(quantity);
     flag=MO.modifyItem(order,id,qu);
   }
   if(action.equals("2")){
     int id=Integer.parseInt(oid);
     flag=MO.deleteItem(order,id);
   }
   if(action.equals("3")){
     flag=MO.deleteOrder(order);
   }
   if(action.equals("4")){
     int de=Integer.parseInt(delivery);
     flag=MO.modifyMethod(order,de,1);
   }
   if(action.equals("5")){
     int pay=Integer.parseInt(payment);
     flag=MO.modifyMethod(order,pay,2);
   }
   if(!flag){
     ActionError err= new ActionError ("error.modifyorder");
     errors.add(ActionErrors.GLOBAL_ERROR,err);
     this.saveErrors(request,errors);
     return mapping.findForward("error");
   }
  }
  catch(Exception e){
    ActionError err= new ActionError ("error.global");
    errors.add(ActionErrors.GLOBAL_ERROR,err);
    this.saveErrors(request,errors);
    return mapping.findForward("error");
  }
  ListOrder LO=new ListOrder();
  OrderInfo OI=LO.getOrderInfo(order);
  session.setAttribute("order",OI);
  return mapping.findForward("ShowOrders");
 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -