Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Java EE 综合讨论区
» J2EE SDK
打印话题 寄给朋友 订阅主题 |
作者 | 求助:Struts问题 |
guomi2004
发贴: 1 积分: 0 |
于 2008-03-19 20:10
修改数量 页面: <form action="/commerce/cart.do?method=update" method="get"> <table> <tr> <td>数量</td> </tr> <logic:iterate id="cartItem" scope="session" name="Sessio nContainer" property="cart.items"> <tr> <td><input type="text" name="qty_<bean:write name="cartItem" property="id"/>" value="<bean:write name="cartItem" property="quantity"/>"> </td> </tr> </logic:iterate> <tr> <td colspan="1" align="center"> <html:submit></html:submit> </td> </tr> </table> </form> action: public class GetItemDetailActions extends CommerceDispatchAction { public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { // TODO Auto-generated method stub updateQuantity(request); return mapping.findForward("success"); } private void updateQuantity(HttpServletRequest request){ SessionContainer sessionContainer=this.getSessionContainer(request); Enumeration enum1=request.getParameterNames(); while(enum1.hasMoreElements()){ String ids=(String)enum1.nextElement(); if(ids.startsWith("qty_")){ String qtyString =request.getParameter(ids.substring(4,ids.length())); sessionContainer.getCart().updateQuantity(Integer.parseInt(ids), Integer.parseInt(qtyString)); } } } } struts-config。xml <action path="/cart" scope="request" type="commerce.action.GetItemDetailActions" validate="false" parameter="method" > <forward name="success" path="/commerce/cart.jsp"></forward> </action> 异常: javax.servlet.ServletException: Request[/cart] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text. org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:222) org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:256) org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 我有一点感想和初学者们同享(原创) |
话题树型展开 |
人气 | 标题 | 作者 | 字数 | 发贴时间 |
17053 | 求助:Struts问题 | guomi2004 | 2441 | 2008-03-19 20:10 |
13386 | Re:求助:Struts问题 | hy806806 | 169 | 2008-07-28 16:31 |
13297 | Re:求助:Struts问题 | andy_wang_5 | 57 | 2008-07-30 09:32 |
13237 | Re:求助:Struts问题 | tiger_hlq | 63 | 2008-09-12 10:46 |
13688 | Re:求助:Struts问题 | nihaolaogao | 171 | 2008-11-21 23:54 |
已读帖子 新的帖子 被删除的帖子 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |