Hi Terry,

   My struts.xml looks like this :

<struts>
    <package name="AJAXLogin" extends="struts-default">
<global-results> 
            <result name="methodNotSupported" type="httpheader"> 
                405 
                The requested method is unsupported 
            </result> 
            <result name="error">/JSPPages/Exception.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> 

<action name="Validation" class="cts.com.LoginValidation">
            <result name="input">/JSPPages/LoginPage.jsp</result>            
            <result name="Admin">/JSPPages/Admin.jsp</result>
            <result name="Common">/JSPPages/Common.jsp</result>
            <result name="blank">/JSPPages/Blank.jsp</result>
            <result name="error">/JSPPages/Error.jsp</result>             
</action>
</package>
</struts>

My action class LoginValidation.java contains getter and setter methods for
the textfield (username) and password (password) field defined in
LoginPage.jsp.

In the execute method of action class I am explicitely calling the
NullPointerException.
i.e.,

@Override
    public String execute() throws Exception {
throw new NullPointerException();
}

When this action class is called I should get the /JSPPages/Exception.jsp
page but currently I am not getting the actual page. Is it necessary to
define exception in the action tags of struts.xml

<action name="Validation" class="cts.com.LoginValidation">
<exception-mapping exception="java.lang.NullPointerException"
result="error"/>
</action>



Thanks in advance,
===============================================================================

Terry Gardner-2 wrote:
> 
> Can you be a little more clear about your ask? Using the examples in  
> the given URL, are you asking about:
> 
> 1. How to code exception.jsp?
> 2. How to code SQLExceptionAction.java?
> 3. What is on the ValueStack in these examples and an Exception occurs?
> 4. something else?
> 
> On Apr 27, 2009, at 4:34 AM, NR031 wrote:
> 
>>
>> Hi,
>>
>>   I am using Struts 2.0.11 and NetBeans 6.1. Is there any way to  
>> handle
>> exception in Struts 2?
>>
>>   I saw the tutorial given
>> http://struts.apache.org/2.0.11/docs/exception-configuration.html
>> http://struts.apache.org/2.0.11/docs/exception-configuration.html ,  
>> but it
>> doesn't contain a sample example that demonstrate the Exception  
>> Handling. I
>> am new to Struts so please explain with an example.
>>
>>
>> Thanks in advance,
>> -- 
>> View this message in context:
>> http://www.nabble.com/Exception-Handling-in-Struts-2.0.11-tp23252025p23252025.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
> 
> 
> ======
> 
> Terry Gardner
> terry.gard...@sun.com
> Skype: Terry_J_Gardner
> 
> "Vulcans never bluff." -- Spock
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Exception-Handling-in-Struts-2.0.11-tp23252025p23252800.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to