This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Caching problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Caching problem." Watch "Caching problem." New topic
Author

Caching problem.

Ram Gokul
Ranch Hand

Joined: Oct 07, 2005
Posts: 85
Hi I have a caching problem.

JSp page bb.jsp construct a String from request parameter ,that is then passed to a custom tag.

I have the following code in bb.jsp

<% response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", -1);
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
%>

The first time the parameter value is passed.

Now the second time , I change the parameter value . But bb.jsp is rendered , it is still showing the first parameter value . How can i see the new value ?

I dont think this is Browser refresh problem because I open the page from 2 seperate browser . The second browser still shows value of parameter that was passed from first browser.

The code

Url -1: bb.jsp?configfile=valid.xml
Url -2: bb.jsp?configfile=Invalid.xml

bb.jsp:
===
<% response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", -1);
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
%>

<% String s1 = request.getParameter("configfile");
opsession.setConfigFileName (s1); %>

====

Thanks a lot
[ September 07, 2006: Message edited by: Ram Gokul ]
Divya Guttikonda
Ranch Hand

Joined: Mar 09, 2005
Posts: 47
Hi,You might find this useful.
http://support.microsoft.com/kb/q222064/
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
Your no-cache tags look fine to me.
As an experiment - try refreshing your page and see if it changes. If it does, you have a cache issue, if not, then the issue is elsewhere.

I think you need to show some more code.
What is the variable opsession? Where is it declared? Is it a bean? What scope?
Where do you print out its value?

At a guess, I think you are using <%! declaration %> area, which is not thread safe. Either that or session variables which are not being set properly.
 
 
subject: Caching problem.
 
Similar Threads
remove the data from cache
invalidate session object in struts2
How to load JSP dynamically using mapping.findForward()
Preventing Old page to get loaded
Reloading JSP page when there is any update in the database