valuestack小结
如果struts.xml里面配置的result type最后是redirect。则通过URL传递参数,前台取值问题
例:
<action name="login" type="redirect">/WEB-INF/loginSuc.jsp?username=${username}</result></action>前台使用
<body> <!-- 注:s:property是从值栈里取值。但redirect跳转到jsp页面,值栈里的取都是空的 所以下面的代码取不到值 --> <s:property value="username"/> <!-- 只要有跳转,就会有servletContext,从servletContext取值可以使用#parameters 下面能取到从URL传过来的值 --> <s:property value="#parameters.username"/> </body>
Result:常用的只有四种:
1:dispatcher(默认),redirect,chain,redirectAction
2:全局结果集
global-results | extends
3:参数传递:
A客户端跳转才需要传递
B ${}表达式(不是EL。是ONGL表达式)