在执行action后返回input action时保留actionerror

      输入页面input.jsp需执行setDefaultValue.action给页面设置默认值,提交input.jsp的form会执行另外一个action:dosomeThing.action。在doSomething中有一个逻辑check,如果check失败需要返回input.jsp,准确来说是setDefaultValue.ation,而且要在页面打印action error。

      如果配置为:

那么actonerror可以打印,但input.jsp不会有默认值。

      如果配置为:

显而易见,有默认值,但丢失了actionerror。

      有效的配置是:

指定默认拦截器栈不拦截setDefaultValue,

指定input type为chain,使得执行doSomething后,action error值仍然能够继续保留到下一个action中:

基础还是要好好学习滴......

参考Apache中对workflow拦截器的描述:http://struts.apache.org/2.0.11/docs/workflow-interceptor.html

The order of execution in the workflow is:

  1. If the action being executed implements Validateable, the action's Validateable#validate() validate method is called.
  2. Next, if the action implements ValidationAware, the action's ValidationAware#hasErrors() hasErrors method is called. If this method returns true, this interceptor stops the chain from continuing and immediately returns Action#INPUT
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值