File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion 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: 1027
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Caching problem.