wood burning stoves 2.0*
The moose likes Servlets and the fly likes ServletContext problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "ServletContext problem" Watch "ServletContext problem" New topic
Author

ServletContext problem

Li Xin
Ranch Hand

Joined: Feb 06, 2004
Posts: 37
In my servlet, I read the variable stored in the ServletContext and forward to JSP to display, but sometimes, after the variable is updated in ServletContext, the JSP page does not reflect it on some machine. Is this the problem of the browser? Any one can help?

Thanks.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It could be a caching problem with the browser, or it could be with your code. It's hard for us to say from here.

If it's a caching issue there are various techniques for telling the browser, and server not to cache content such as the no-cache meta tag:

There are issues with both MSIE and netscape that keep this from always working. See:http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q234067

You can also set the headers directly:


The surest way IMHO, is to make certain the url is always unique. This can be done by adding a bogus querystring variable to the end with a timestamp as a value.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ServletContext problem