• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JSP session tracking problem

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody.....i am a newbie to jsp. I just started writing a login page using jsp, partial code of which is given below.....
My requirement is that if there is no session exists.....it should show the login field table.....otherwise it should show welcom + usename by getting it from session.getAttribute....the action of the form is again the same jsp page for now...

Is this is the correct way of doin it or....any other way...the problem that I am facing if i do it in this way is that....after submitting the login form, the page will not be reloaded so...even if there is a session exists, again the login table is being displayed...so, if i refresh it once and see...a welcome message is appearing...

if at all i am forced to go in this way....how to automatically reload the page after submitting the login form....please help me in this regard

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean, the page won't be reloaded after a form submission? It's a complete request cycle--*something* will be loaded, you won't just stay on the same page. Maybe you're confused because you set the session attribute after you test for its presence.

You might want to take a step back and first figure out how HTTP/request/etc. work before going to much further. And using scriptlets in JSP, and submitting to JSPs, is an antiquated coding practice--yuck.
 
There's a way to do it better - find it. -Edison. A better tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic