For example:
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException:
the request was rejected because its size (337867) exceeds the configured
maximum (200)
For example:
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException:
the request was rejected because its size (337867) exceeds the configured
maximum (200)
You can use exception mapping feature of Struts2 to map exception to specific result
.
In struts.xlm
file put <exception-mapping>
definition inside <global-exception-mappings>
and create result
, with defined name, global or in specific action(s).
<global-exception-mappings>
<exception-mapping exception="java.lang.NullPointerException" result="npe"/>
</global-exception-mappings>
Note that your interceptor stack must include exception
interceptor. Also it is recommended that exception
interceptor would be the first interceptor on the stack, ensuring that it has full access to catch any exception, even those caused by other interceptors.