Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Not able to manage JSP sesisons  RSS feed

 
Pranit Sonawane
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all I'm trying to keep the user logged in but once the user logs in it displays the message welcome, username. but when user clicks on change password link the it shows welcome null it means shows the user logged out kinda! please suggest what is happening? here's the code!!

userhome.jsp



AdminLoginCredentials.jsp



now when user goes on another page it shows welcome null Where am I going wrong. please help me :(
 
Gaurav Wadhwani
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to keep the user logged in but once the user logs in it displays the message welcome, username. but when user clicks on change password link the it shows welcome null it means shows the user logged out kinda! please suggest what is happening?


For the first page, where the user enters username -> request.getParameter() will work because parameters have been set! . But it wont work for any subsequent request because there is no parameter set, so how can it fetch?
To make it work, you can

1. Get the parameters in the String-> request.getParameter("parameter");
2. Store the parameters as attributes for session - > hs.setAttribute("attribute", variable);
3. Make sure your session remains alive for the required interval -> hs.setMaxInactiveInterval(seconds); . Atleast 1 minute (depends on application)
4. For any other page to get the username, hs.getAttribute("name of attribute");
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!