形如user.do?to=index这样的url
sturts2为何获取不到to的值??
sturts2为何获取不到to的值??
解决方案 »
- Struts 2.0配置。救命啊!!!1
- String s = new String("xyz");创建了几个String Object?
- 解决一个sql的查询问题,在线等
- Struts2 已经有非常好的IoC了,再集成Spring的意义何在?
- 求助,用struts2配置了多个struts.xml,可是提示There is no Action mapped for namespace / and action name test. - [unknown location]
- 关于hibernate 关联查询的,请高手解答
- 关于方法调用的问题!
- 对于接口可不可以这样实现?大概思路,这样有没有使用价值
- JDOM的问题,帮帮忙
- enum支持中文字符?
- 请进!帮个忙!
- weblogic 9.2 MyEclipse部署应用程序问题
ActionContext.getContext().getParameters().get("to")你是这样获取的吗?
但是还是获取不到
拓展名为.do是我设置的 没有采用默认的.action
我的这个user.do?to=index 是 在struts.xml中 redirect过来的
就是访问不到to的值
高手请赐教!
String to = (String)ServletActionContext.getRequest().getParameter("to");
ActionContext ctx = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)ctx.get(ServletActionContext.HTTP_RESPONSE);
是的,struts2要转一下弯才能得到request, response对象
redirect过来的参数是得不到的.
<param name="location">user.do</param>
<param name="to">index</param>
</result>可以到这找找答案http://struts.apache.org/2.x/docs/core-developers-guide.html