2009/4/27 NR031 <[email protected]>:
>   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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to