foodmodifyaction.java

来自「一个完整的网络订餐系统」· Java 代码 · 共 57 行

JAVA
57
字号
package com.food.web.action;


import org.apache.struts.action.ActionForward;
import com.common.struts.*;
import com.common.*;
import com.food.dao.FoodDao;
import com.food.form.Food;

public class FoodModifyAction extends AbstractAction {
  public FoodModifyAction() {
  }

  public ActionForward execute(ActionContext actionContext) throws java.lang.Exception {
     //SessionContext ctx = (SessionContext) actionContext.getSession().getAttribute(Globals.SESSION_CONTEXT);
     //String userID = ctx.getUserID();

     String foodID = actionContext.getParameter("foodID");
     String foodName = actionContext.getParameter("foodName");
     String foodType = actionContext.getParameter("foodType");
     if(("").equals(foodType) || foodType==null)
        foodType = actionContext.getParameter("foodType1");

     String sbigPrice = actionContext.getParameter("bigPrice");
     float  bigPrice=0.0f;
     if(!(("").equals(sbigPrice) || sbigPrice==null))
         bigPrice = Float.parseFloat(sbigPrice);

     float  smallPrice = 0.0f;
     String sSmallPrice    = actionContext.getParameter("smallPrice");
     if(!(("").equals(sSmallPrice) || sSmallPrice==null))
         smallPrice = Float.parseFloat(sSmallPrice);

     float  snackPrice = 0.0f;
     String sSnackPrice    = actionContext.getParameter("snackPrice");
     if(!(("").equals(sSnackPrice) || sSnackPrice==null))
         snackPrice = Float.parseFloat(sSnackPrice);

     String descript = actionContext.getParameter("descript");
     String foodImage = actionContext.getParameter("foodImage");

     String foodClass = actionContext.getParameter("foodClass");
     if(("").equals(foodClass) || foodClass==null)
        foodClass = actionContext.getParameter("foodClass1");


    String storeID = actionContext.getParameter("storeID");

     Food info = new Food(foodID,foodName,foodType,bigPrice, smallPrice,snackPrice,descript,foodImage,foodClass,storeID);

     FoodDao dao = new FoodDao();
     dao.updatFoodToDb(info);

     return actionContext.getMapping().findForward("foodModifyend");
   }
}

⌨️ 快捷键说明

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