输入页面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:
- If the action being executed implements Validateable, the action's Validateable#validate() validate method is called.
- 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