I want to pass exceptions globally to a single action file called ErrorAction
, say from Index action.
Here's my struts.xml
file:
<global-results>
<result name="myErrorHandler" type="redirectAction">
<param name="actionName">myError</param>
</result>
<result name="login" type="tiles">
login
</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="myErrorHandler" />
</global-exception-mappings>
<action name="myError" class="com.actions.ErrorAction">
<interceptor-ref name="exception" />
<interceptor-ref name="defaultStack" />
<result name="error" type="tiles">error</result>
</action>
....
<action name="Index" class="com.actions.Index">
<interceptor-ref name="defaultStack" />
<result name="success" type="tiles">home</result>
</action>