Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

JSP Session  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need help with JSP session.

My problem:
I have a login page. When a user logs in then, i set a session and its expiration time. So, when the session is expired, the user will be redirected to the login page with a session expired message.
I want to identify if a page has been loaded first time by the user, or it has been loaded as a result of expiration of session.

My code:

I do the following when the user successfully logs in:


I check this in every page (i.e. check in the header of everypage)



Also when the user logs out the following code is executed:


My problem is that even when the user comes to the page for first time, it redirects the user to "login.jsp?rtype=expired" page.
 
Author and ninkuma
Marshal
Posts: 66797
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't be doing this on the pages at all. Use a servlet filter.
 
Virendra Chandak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I am new to jsp, and don't have much knowledge about it. Could you please elaborate a bit and give some example?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66797
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look up "servlet filter"
 
Marshal
Posts: 5964
911
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our ServletFilters FAQ has some useful information.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!