trace, debug, info, warn, error, fatal
)? - defaut is debug
com.mycompany.app
). Default is to use com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor
.<xwork> <package name="default" extends="xwork-default"> <global-results> <result name="error" type="freemarker">error.ftl</result> </global-results> <global-exception-mappings> <exception-mapping exception="java.lang.Exception" result="error"/> </global-exception-mappings> <action name="test"> <interceptor-ref name="exception"/> <interceptor-ref name="basicStack"/> <exception-mapping exception="com.acme.CustomException" result="custom_error"/> <result name="custom_error">custom_error.ftl</result> <result name="success" type="freemarker">test.ftl</result> </action> </package> </xwork>This second example will also log the exceptions using our own category
com.mycompany.app.unhandled at WARN level. <xwork> <package name="something" extends="xwork-default"> <interceptors> <interceptor-stack name="exceptionmappingStack"> <interceptor-ref name="exception"> <param name="logEnabled">true</param> <param name="logCategory">com.mycompany.app.unhandled</param> <param name="logLevel">WARN</param> </interceptor-ref> <interceptor-ref name="i18n"/> <interceptor-ref name="staticParams"/> <interceptor-ref name="params"/> <interceptor-ref name="validation"> <param name="excludeMethods">input,back,cancel,browse</param> </interceptor-ref> </interceptor-stack> </interceptors> <default-interceptor-ref name="exceptionmappingStack"/> <global-results> <result name="unhandledException">/unhandled-exception.jsp</result> </global-results> <global-exception-mappings> <exception-mapping exception="java.lang.Exception" result="unhandledException"/> </global-exception-mappings> <action name="exceptionDemo" class="org.apache.struts2.showcase.exceptionmapping.ExceptionMappingAction"> <exception-mapping exception="org.apache.struts2.showcase.exceptionmapping.ExceptionMappingException" result="damm"/> <result name="input">index.jsp</result> <result name="success">success.jsp</result> <result name="damm">damm.jsp</result> </action> </package> </xwork>
@author Matthew E. Porter (matthew dot porter at metissian dot com)
@author Claus Ibsen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|