Вопрос

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top