This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP: check if user is logged on Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP: check if user is logged on" Watch "JSP: check if user is logged on" New topic

JSP: check if user is logged on

Vivek Kr Agrawal
Ranch Hand

Joined: Sep 08, 2012
Posts: 51

I am creating a small project (CRUD) for my college in JSP. The problem is that a user can create,read,update and delete items only after he gets logged in. I have created all things and its working all fine. But how can I check that this is a logged user or not in my every jsp page.
If it is not a logged one then it should be redirected to index.jsp.
I know I have to session variables but don't know how to use it? Please also provide me the best coding practice to write this code once and include in all subsequent files.

Thanks in advance!!

Vivek Agrawal
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60765

Servlet filter.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
wood burning stoves
subject: JSP: check if user is logged on
Similar Threads
checking whether user logged in or not
How to pass string value from jsp to java class
How to control static pages and dynamic pages
How to ristrict multiple login's at the same time using same username?
showing pages based on roles