您的位置:首页 > 编程语言 > Java开发

struts2 redirect 配置动态传递参数

2015-06-16 15:59 465 查看
<action name="actionName" class="com.towerking.TestAction" method="executeMethod">
<result name="success" type="redirect">login.jsp?flag=success&userType=${userType}</result>
<result name="error" type="redirect">login.jsp?flag=error&userType=${userType}</result>
</action>


在配置Struts2的时候,有时需要配置多个参数,且其中一个参数是根据实际情况动态变化的,则需要通过上述方法进行配置。

其中在XML文件中,配置 & 需要使用

&


否则Struts2会出现如下错误:struts2 the reference to entity must end with the ' ;' delimiter。

在配置代码中userType的引用值,需要在对应的action中赋值,否则无法获取到。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: