我在显示页面做了这样一个连接
<a href='<html:rewrite action="/control/shops/manage"/>?method=editUI&shopid=${entry.shopid}'>然后连接到修改页面
我form表单里面也有 shopid
在修改页面也写上了 <html:hidden property="shopid"/>
我在action 中这样写发现shopid是为空的 public ActionForward editUI(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ShopsForm formbean=new ShopsForm();
MyShops myshops=shopsService.find(MyShops.class, formbean.getShopid());
System.out.println(formbean.getShopid());
formbean.setName(myshops.getName());
formbean.setManagername(myshops.getManagername());
formbean.setContactInfo(myshops.getContactInfo());
formbean.setDescription(myshops.getDescription());
//formbean.setLogopath(myshops.getLogopath());
request.setAttribute("shopareas",myshops.getShopArea().getArea());
return mapping.findForward("edit");
}
<a href='<html:rewrite action="/control/shops/manage"/>?method=editUI&shopid=${entry.shopid}'>然后连接到修改页面
我form表单里面也有 shopid
在修改页面也写上了 <html:hidden property="shopid"/>
我在action 中这样写发现shopid是为空的 public ActionForward editUI(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ShopsForm formbean=new ShopsForm();
MyShops myshops=shopsService.find(MyShops.class, formbean.getShopid());
System.out.println(formbean.getShopid());
formbean.setName(myshops.getName());
formbean.setManagername(myshops.getManagername());
formbean.setContactInfo(myshops.getContactInfo());
formbean.setDescription(myshops.getDescription());
//formbean.setLogopath(myshops.getLogopath());
request.setAttribute("shopareas",myshops.getShopArea().getArea());
return mapping.findForward("edit");
}
解决方案 »
- 如何提交表单后在当前页面显示结果?
- 大家说说struts里面的form里面的get和set方法有什么好处啊?
- myeclipse问题
- (给高分)疑问?大家常用什么工具开发jsp?
- 关于Resin目录映射与URL重写Rewrite技巧的总结
- 想做读取数据库值的四级联动下拉菜单,请高手帮帮忙了,80分送
- 谁能推荐一个好用的处理Http协议的代码
- 用hibernate,axis2发布webservice调用时出错
- 大家好,小菜鸟有个简单的初级问题请教!
- 用JSP怎么联接SQLServer的数据库啊
- Struts 2.x中Stack Context是怎样的存值空间??高手来
- 做这样的网站 前期需要设计哪些?
我通常的做法是: 利用隐藏表单域来做的。<a href = "javascript:functionName()">function functionName(){ /*form是在页面上定义的用来传你要传的参数*/
form.propertyName = propertyValue;
.....有几个参数要传就写几个
form.action = 提交的路径;
form.submit();}当然我在系统里面是用的封装好的js 来搞定的。感觉 用重写url不是那么靠普。[当有中文时还要处理有点烦。]
可以用request.getParameter("shopid");获取到值
如果想用Form的形式获取到值,则可以写个隐藏的text
如 ShopsForm form = ( ShopsForm )form;
ShopsForm form = ( ShopsForm )form; 这样问题解决了!