Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Not able to manage JSP sesisons

 
Ranch Hand
Posts: 172
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 :(
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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");
 
reply
    Bookmark Topic Watch Topic
  • New Topic