File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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?

Ben Souther

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:;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
I agree. Here's the link:
subject: ServletContext problem
It's not a secret anymore!