日期:2014-05-17  浏览次数:20645 次

struts2中action接受不到传来的参数
action跳转到另一个页面去,同时将参数再传到页面去,但是没有得到值

<action name="list" class="com.opensymphony.xwork2.ActionSupport" method="execute"> 
<result name="success" type="redirect">/empleeyAdd.jsp?uname=${uname}</result>
</action>
红色的地方提示拼写错误,但是没有错,而且编译能通过

这是浏览器的结果,没有参数值
http://localhost:8080/struct2/empleeyAdd.jsp?name=

------解决方案--------------------
浏览器显示值和struts中不一样。可能是struts没编译,java这块的这种情况多的是了,可以在服务器里面把项目删掉重新加载下看看,要不在jsp用小脚本 string name=requst.getRequestPlement单词应该没写错(“action中的属性也就是 uname”); 记得封装一下 要不保存到session中也可以 方法多的时,这种方法不行就换呗!