0

I have a J2EE application which uses JSF and Spring 3.x. My web app is developed in *.xhtml, and I have used JSF ManagedBeans. I want to redirect to login page when the session has elapsed the timeoout. I am bit new and need to know the following.

  1. How to set the session timeout time(Basically I want to set a maximum time where the application would be idle and redirect to the login page with an invalid session)
  2. What is the meta tag which I need to place in my *.xhtml which will direct to the login page?

Hope the requirement is clear. Just stating the requirements of my problem again

  1. System should not invalid the session as far as the user is interacting with the system.
  2. It Should only invalid the session and redirect to the login page when the system has been idle for a given time.

Tech Stack JSF with ManagedBeans(Have used face-config.xml etc..) Spring for the service layer Hibernate for the DAO layer and in defining the entities.

  • Simply just need to know how can we handle session timeout and automatic redirect to login page in a J2EE (JSF and Spring 3.x) app running on top of Tomcat.. Please assist – Rashendra - Rashen Mar 25 '15 at 10:13

1 Answers1

2

If by "idle" you mean not sending any request to the server then you have to set the session-timeout in your web.xml file. It should look like this for a 30 minutes timeout :

<session-config>
    <session-timeout>30</session-timeout>
</session-config>

To handle the redirection to login when the session timeout have a look at this answer.

Community
  • 1
  • 1
ForguesR
  • 3,558
  • 1
  • 17
  • 39