Struts2 使用mordelDriven,页面获取 值
博客分类: web前端
程序员文章站
2024-03-22 15:39:28
...
当返回result前对业务对象修改了,但是值栈中对应的对象依然是之前的就值,若想在返回result之前刷新值栈中业务对象各个属性的根对象,需在该action中配置如下参数:
[html] view plaincopyprint?
<action name="studentAction"
class="com.amouse.student.action.StudentAction">
<interceptor-ref name="defaultStack">
<!-- 渲染页面前刷新model在ValueStack的root的引用 -->
<param name="modelDriven.refreshModelBeforeResult">
true
</param>
</interceptor-ref>
<result name="main">/pages/student/student.jsp</result>
<result name="login">/pages/student/login.jsp</result>
<result name="success">/pages/student/studentInfo.jsp</result>
</action>
[html] view plaincopyprint?
<action name="studentAction"
class="com.amouse.student.action.StudentAction">
<interceptor-ref name="defaultStack">
<!-- 渲染页面前刷新model在ValueStack的root的引用 -->
<param name="modelDriven.refreshModelBeforeResult">
true
</param>
</interceptor-ref>
<result name="main">/pages/student/student.jsp</result>
<result name="login">/pages/student/login.jsp</result>
<result name="success">/pages/student/studentInfo.jsp</result>
</action>