2009/4/27 NR031 <nataraja...@cognizant.com>: > I am using Struts 2.0.11 and NetBeans 6.1. Is there any way to handle > exception in Struts 2?
Just define global result and put entries for given exceptions in struts.xml, like below <global-results> <result name="methodNotSupported" type="httpheader"> <param name="error">405</param> <param name="errorMessage">The requested method is unsupported</param> </result> <result name="error">/jsp/error.jsp</result> </global-results> <global-exception-mappings> <exception-mapping exception="java.lang.NoSuchMethodException" result="methodNotSupported"/> <exception-mapping exception="java.lang.IllegalArgumentException" result="methodNotSupported"/> <exception-mapping exception="java.lang.NullPointerException" result="error"/> </global-exception-mappings> Regards -- Lukasz http://www.lenart.org.pl/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org