Puzzling Browser Refresh and session attribute behavior

Discussion in 'Java' started by GIMME, Apr 14, 2004.

  1. GIMME

    GIMME Guest

    An application goes from jsp 1 to jsp 2.

    Jsp 2 modifies a session attribute which is displayed on jsp 1.
    Jsp 2 never displays, it always forwards (see below) back to jsp 1.
    Jsp 2 removes the session attribute and sets it.

    Sometimes jsp 1 does not display the most recent value of the
    session attribute - to see it the user must click the browser's
    refresh button.

    Any suggestions?



    public void DoForward( HttpServletRequest request,
    HttpServletResponse response, String sURL) {
    try {
    response.setContentType("text/html; charset=UTF-8");
    request.getRequestDispatcher(sURL).forward(request,response);
    } catch (javax.servlet.ServletException ex ) {
    System.out.println("DoForward()
    javax.servlet.ServletException " + sURL );
    ex.printStackTrace();
    } catch (java.io.IOException ex ) {
    System.out.println("DoForward() java.io.IOException " +
    sURL);
    ex.printStackTrace();
    }
    }

    Also in Jsp 2 :

    session.removeAttribute("tl");
    session.setAttribute("tl",tl);
     
    GIMME, Apr 14, 2004
    #1
    1. Advertisements

  2. GIMME

    Chris Smith Guest

    GIMME wrote:
    > An application goes from jsp 1 to jsp 2.
    >
    > Jsp 2 modifies a session attribute which is displayed on jsp 1.
    > Jsp 2 never displays, it always forwards (see below) back to jsp 1.
    > Jsp 2 removes the session attribute and sets it.
    >
    > Sometimes jsp 1 does not display the most recent value of the
    > session attribute - to see it the user must click the browser's
    > refresh button.
    >
    > Any suggestions?


    Sounds like a client caching problem to me. Are you sure that the
    problem is with your JSP rather than with the client cache?

    --
    www.designacourse.com
    The Easiest Way to Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, Apr 15, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Smythe
    Replies:
    3
    Views:
    1,544
    Jeff Smythe
    Jan 2, 2004
  2. Per Magnus L?vold
    Replies:
    1
    Views:
    5,672
    John C. Bollinger
    Oct 8, 2004
  3. =?Utf-8?B?RGFiYmxlcg==?=

    browser refresh effect on session variables and view state?

    =?Utf-8?B?RGFiYmxlcg==?=, Aug 7, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    908
    Kumar Reddi
    Aug 8, 2006
  4. Replies:
    3
    Views:
    422
  5. Replies:
    0
    Views:
    360
  6. Jav
    Replies:
    3
    Views:
    287
  7. Replies:
    5
    Views:
    310
  8. VK
    Replies:
    4
    Views:
    284
Loading...