Results 1 to 2 of 2
  1. #1
    noufalcm is offline Member
    Join Date
    Dec 2010
    Rep Power

    Default Session Expiry on JSF

    Hi friends,
    I have an application on JSF framework. When I click logout, the session expires. But when I click the BACK buton in the browser, the former session(the loged out username) is on. What is the solution for this such that if the user clicks back button also, the page should take to login.

    This is my code for the logout action

    public String expored() {
    HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalConte xt().getSession(false);
    if (session != null) {
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = new Date();
    current_time = dateFormat.format(date);
    try {
    connection = DataBaseConnection.getConnectionIPF();
    statement = connection.createStatement();
    resultSet = statement.executeQuery("select MAX(InTime) from logindetails where UserName='" + lb.username + "'");
    while ( {
    intime = resultSet.getString(1);
    statement.executeUpdate("update logindetails set OutTime='" + current_time + "' where InTime='" + intime + "' AND UserName='"+lb.username+"'");
    } catch (Exception ee) {"Error in logoubean expored method : " + ee.getStackTrace());
    } finally {
    try {

    if (connection != null) {
    } catch (SQLException ex) {"SQL Error in logoubean expored method : " + ex.getStackTrace());
    return "/login";

  2. #2
    madnaelo is offline Member
    Join Date
    Dec 2010
    Rep Power


    I guess this is not a JSF issue, its a browser cache issue. When you click back button, the browser loads the page from its cache, thats why its displaying the logged out user name.

    Did you notice that the page loads by clicking back button, but does not allow you to perform any action? If yes than its confirmed that it is browser cache issue.

    You can solve this by a javascript function which clears your page from the cache, and definitely your jsf logout action must also be called after clearing the page from cache.

Similar Threads

  1. Redirection After Session Expiry
    By sandeep.ctg in forum Advanced Java
    Replies: 0
    Last Post: 05-16-2010, 12:15 PM
  2. Scjp voucher to sell for 4500/- expiry- 11 nov-09
    By circuit_cool in forum Java Certification
    Replies: 1
    Last Post: 10-13-2009, 09:24 PM
  3. Scjp voucher for sale in 4500/- expiry- nov-09
    By somacool19 in forum Java Certification
    Replies: 0
    Last Post: 09-07-2009, 02:49 PM
  4. Replies: 2
    Last Post: 12-23-2008, 07:35 PM
  5. Session Expiry
    By Jack in forum Web Frameworks
    Replies: 1
    Last Post: 07-09-2007, 04:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts