Puzzling Browser Refresh and session attribute behavior

G

GIMME

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);
 
C

Chris Smith

GIMME said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top