java - How to handle exceptions thrown by default interceptors in struts2? -


for example:

org.apache.commons.fileupload.fileuploadbase$sizelimitexceededexception:  request rejected because size (337867) exceeds configured  maximum (200) 

you can use exception mapping feature of struts2 map exception specific result.

in struts.xlm file put <exception-mapping> definition inside <global-exception-mappings> , create result, defined name, global or in specific action(s).

<global-exception-mappings>   <exception-mapping exception="java.lang.nullpointerexception" result="npe"/> </global-exception-mappings> 

note interceptor stack must include exception interceptor. recommended exception interceptor first interceptor on stack, ensuring has full access catch exception, caused other interceptors.


Comments

Popular posts from this blog

css - I want to align grid in center -

python - SWIG function not printing output -

oop - Function for all prototypes - Javascript -