2个回答
展开全部
ps://:注释():(你提问的东西没弄全)//页面指令(pagecontentType="text/html;charset=GBK"import="java.util.*"%>)//导页面指令checkout//这个不全我不知道//判断session中shopcart是否为空,为空则不执行里面的循环(test="${emptysessionScope.shopcart}">)//循环shopcart取值(items="${sessionScope.shopcart}"var="x">)=//显示shopcart里的值${x.value.goodName}${x.value.mount}publicStringexecute(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{//得到全部商品GoodServicegs=newGoodService();Object[][]data=gs.getAllGoods();//把商品放在请求域request.setAttribute("goods",data);//跳转标识return"goods";}//修改商品publicStringupdateview(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{GoodServicegs=newGoodService();Stringgoodid=request.getParameter("goodid");Mapgood;try{//按goodId得到goodgood=gs.getGoodById(goodid);//把good放在请求域request.setAttribute("good",good);//跳转标识return"updateview";}catch(Exceptione){//TODOAuto-generatedcatchblocke.printStackTrace();//把错误放在请求域request.setAttribute("msg","对不起,能要修改的商品不存在");//跳转标识return"error";}}//删除商品publicStringdelete(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{GoodServicegs=newGoodService();//在请求域得到goodIdStringgoodid=request.getParameter("goodid");//调用删除方法booleanresult=gs.deleteGood(goodid);//判断是否删除成功if(result){//跳转标识return"goodsm";}else{//把错误放在请求域request.setAttribute("msg","商品信息删除失败");//跳转标识return"error";}}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询