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

Basic page logout design

 
Greenhorn
Posts: 2
MS IE Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am learning JSP and Servlet concept. In the process, trying to implement login and logout concept in an Application.

My design is as follows:

User enters his credentials in "login.jsp". The page is redirected to "Validate.java" which compares the name and password from the database and directs the request object into "homepage.jsp".
In "validate.java" i create a HttpSession Object using: HttpSession session = request.getSession(true);

Now to logout of the Application i create a hyperlink in "homepage.jsp" which re-directs the application to logout.jsp. But I am not understanding where to invalidate the session which I created in "Validate.java".

I tried to session.invalidate() in the "logout.jsp" but 'session' object seems to be out of scope in this "logout.jsp". (editor says "session" object not found). Please tel me how can i implement logout functionality in my Application.

Thanks,
toddler.
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here some basic tutorials.
Tutorial 1
Tutorial 2 (special atention to "Session Management in JSP" section).

A basic idea for login would be put the user data from database in a beans and then create a session variable.
Then you could ask for Session variable is empty or No in each jsp page.
For logout just clean the session variable.

 
Abhishek yada
Greenhorn
Posts: 2
MS IE Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for directing me..:)
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic