本文介绍了重定向时存储拦截器和松散的值堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个动作.首先显示表单,另一个显示处理表单.如果未验证processAdd动作,则将redirectAction返回到Add动作. Store拦截器在添加"操作上显示正确的错误,但在重定向操作期间丢失了表单上的填充值.

I have 2 actions. First to display form and another to process form. If processAdd action is not validated than redirectAction back to Add action. Store interceptor shows proper errors on the "Add" action but filled in values on the form are lost during redirect action.

loose Value Stack关于重定向,我理解这一点.

I loose Value Stack on redirection, I understand that.

对此有什么解决办法吗?

不想使用结果参数,太多的工作.

Don't want to use result param, too much work.

 <action name="add" class="com.myapp.actions.StudentAction" method="input">
            <interceptor-ref name="store">
                <param name="operationMode">RETRIEVE</param>
            </interceptor-ref>
            <result name="input" type="tiles">/student.edit.tiles</result>
        </action>

        <action name="processAdd" class="com.myapp.actions.StudentAction">
            <interceptor-ref name="store">
                <param name="operationMode">STORE</param>
            </interceptor-ref>
            <interceptor-ref name="defaultStack" />
            <result name="success" type="redirectAction">list</result>
            <result name="input" type="redirectAction">add</result>
            <result name="failure" type="redirectAction">add</result>
        </action>

推荐答案

您正在寻找的是范围拦截器,而不是商店拦截器.

What you're looking for is the Scope Interceptor, not the Store Interceptor.

这篇关于重定向时存储拦截器和松散的值堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 11:25