The problem I face is that when the 2 parameters in the if statement do not match, error.jsp is called and works fine but, when the parameters match "aditya", a NullPointerException is thrown. The error reflected by the server says that the error is on the if statement(Line 20). The if statement returns Null instead of dispatching to welcome.jsp.
Waiting for a reply, please help me as its frustrating.
So it is that line? Then either the variable a or b is null. Calling any method where the variable is null will give you a NullPointerException regardless of the mehtod you choose. You can check either are not null before performing your check. Or, sicne this is a web applicaiton, define an error page in web.xml.
Joined: May 27, 2008
if either a or b is null, then how does the else condition work fine???
is'nt request.getParameter() returning a string which is not matching "aditya" and hence error.jsp is called. How then can null be returned??