【发布时间】:2013-09-06 13:59:08
【问题描述】:
当我在 Struts 2 中使用 dispatcher 时,我没有收到操作错误。
在动作类中,下面的代码用于添加错误信息。
addActionError("Error");
return "Failure";
在 Struts 配置中:
...
<result name="Failure" type="dispatcher">/ShowError.do</result>
...
<action name="ShowError">
<result>/jsp/ShowActionErrror.jsp</result>
</action>
在ShowActionErrror.jsp:
<div class="error"><s:actionerror /></div>
但是,我在ShowActionErrror.jsp 中没有收到操作错误消息?
【问题讨论】:
-
要将调度程序与操作一起使用,您需要配置容器以通过 S2 过滤器处理转发。不过,总的来说,我建议不要这样做。
标签: java jsp struts2 error-handling actionresult