The moose likes JSP and the fly likes Session Detection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Session Detection" Watch "Session Detection" New topic

Session Detection

Jon Kidd

Joined: Oct 11, 2002
Posts: 29
Hi all,
relatively new to jsp and servlets so bear with me please...
I am trying to create a jsp page with a simple form, this form then calls a servlet to validate the fields and if they have not been filled in correctly then it forwards back to the form page.
I am having trouble though detecting on the jsp page as to whether the form has been checked already. I have tried setAttribute for the session but this is causing nullPointer problems when I first access the form as I think it is trying to access attributes from the session that don't currently exist ?
If anyone has a simple solution to this problem then I'd be grateful for some help, apologies for the lack of code but I think it best if maybe someone just hints out the proper way of doing it and I'll try that before posting anything.
Thanks in advance
Jon Kidd

Joined: Oct 11, 2002
Posts: 29
Found the answer, easy when you know how !! Just need to use the Boolean isNew() method for session..... d'oh!!
It is sorta covered in the JavaRanch Style Guide.
subject: Session Detection
Similar Threads
doubt in session
Session problems with JSP on ServletExec, W2000
Problem with session tracking
URGENT Help Needed ...!!
How to update Session variable with Form Data ?