File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP session tracking problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP session tracking problem" Watch "JSP session tracking problem" New topic

JSP session tracking problem

Raghavender Ammagari

Joined: Aug 11, 2008
Posts: 13
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 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, if i refresh it once and see...a welcome message is appearing...

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

David Newton

Joined: Sep 29, 2008
Posts: 12617

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.
I agree. Here's the link:
subject: JSP session tracking problem
It's not a secret anymore!