struts2验证结果输入不能是一个action
我有一个操作 Registration.java,用于用户创建帐户。 该动作类有两个方法:doList 和execute。 doList 从数据库获取数据并使用一些 s:select 标记呈现初始 jsp 页面。 执行实际的业务逻辑。
在struts.xml中:
<action name="InitList" method="list" class="......Registration" >
<result name="success">/..../...../Registration.jsp</result>
<action name="Registration" class="......Registration">
**<result name="input" >InitList.action</result>**
<result name="next" type="redirect">InitListReg.action</result>
</action>
我还有一个验证配置文件:RegistrationAction-Registration-validation.xml
当我创建一些验证错误并且初始页面未显示错误:InitList.action 不可用时。看来strut2s没有识别出InitList动作。当我像这样更改结果输入时:
<action name="Registration" class="......Registration">
**<result name="input" type="redirect">InitList.action</result>**
<result name="next" type="redirect">InitListReg.action</result>
</action>
初始页面已成功显示,但验证错误消息由于“重定向”而丢失且未显示。
所以我想知道输入是否可以是一个动作或者只支持jsps。或者我该如何解决我的问题?
I have an action Registration.java which is used for users to create an account.
this action class has two methord: doList and execute.
doList gets data from the database and renders the initial jsp page with some s:select tags.
execute do the actual business logics.
in the struts.xml:
<action name="InitList" method="list" class="......Registration" >
<result name="success">/..../...../Registration.jsp</result>
<action name="Registration" class="......Registration">
**<result name="input" >InitList.action</result>**
<result name="next" type="redirect">InitListReg.action</result>
</action>
I also have a validation config file: RegistrationAction-Registration-validation.xml
when i created some validation error and the intial page was not displayed with the error: InitList.action is not available. It seems strut2s did not recognized the action InitList. When i change the result input like this:
<action name="Registration" class="......Registration">
**<result name="input" type="redirect">InitList.action</result>**
<result name="next" type="redirect">InitListReg.action</result>
</action>
the initial page was displayed successfully, but the validation error messages were lost and not displayed because of "redirect".
So i wonder if input can be an action or only support jsps. Or how can i fix my problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您将 Struts2 验证与重定向一起使用时,您需要 MessageStoreInterceptor< /a>.
When you use the Struts2 Validations togehther with redirect you need the MessageStoreInterceptor.