Hi,
I m new to jsp and currently i m trying to fix this problem.
In my project, we have an enhancement where we are trying to access a changepassword.jsp 1) directly through URL 2)Invoking this jsp after loginhandler.jsp.
1) is for existing users. 2) is for new users.
We have seperate error codes for new and existing users.
The 2) option is working fine. Here a new user first logs in (into the loginhandler.jsp). His errorcode is recorded using setAttribute(). Then, he is shown the changepassword.jsp and here, getAttribute(errorcode) is done and then, the new user is allowed to change the password.
However, in 1) option, we are still using the same changepassword.jsp. As a result of this, when the code encouters getAttribute(errorcode), the logic fails since this jsp is directly accessed from URL and it doesn't understand from where it has to get the attribute.
The piece of code in loginhandler.jsp is tring resul=loginRes+" ";
session.setAttribute("errorcode",resul);
------------------------------------------------------------------------------------------------------
The piece of code in changepassword.jsp is :
String ercode=(String)session.getAttribute("errorcode");
String errcode=ercode.trim();
int erCode = Integer.valueOf(errcode).intValue();
if(erCode==3016){
...........
}
Can someone help me as to how i can manage to keep the code in changepassword.jsp and handle both the kinds of users.