문제

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