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. Advertising

  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. Advertising

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. Replies:
    3
    Views:
    281
  2. Replies:
    0
    Views:
    272
  3. Jav
    Replies:
    3
    Views:
    148
  4. Replies:
    5
    Views:
    111
  5. VK
    Replies:
    4
    Views:
    147
Loading...

Share This Page