aspose file tools*
The moose likes JSP and the fly likes Problem with browser caching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem with browser caching" Watch "Problem with browser caching" New topic
Author

Problem with browser caching

Pranav Bhatt
Ranch Hand

Joined: Mar 20, 2006
Posts: 284
Hi,
I'am working on a pagination problem. I am posting data from my Action class to the display JSP and when user press Next link again flow goes to Action class then to same JSP again with new data.

i have used the rownum query in action and it keeps changing the lower_bound and upper_bound with every call to execute() in my action as below-:


with each call from my jsp with Next link .

All is working fine but am getting the rows appended with previous rows in my JSP. That is for first request am getting 15 rows. Again a click on Next is giving me 30 rows with 15 new rows appended to previous 15. I tried to clear browser cache as below but it doesn't seem to work-:


My URL is not same for every query as my page parameter value is getting changed every time still its not working as expected.

I had put a output statement on Action class, just to be sure am getting result in incremental sets. It seems fine from below result of two consecutive calls-:



Please inform i did not make my point clear. i tried this in Mozilla, IE , both gives same result.

Anyone having any idea how to get around this...
Pranav Bhatt
Ranch Hand

Joined: Mar 20, 2006
Posts: 284
Thanks i have solved it.. Its working now..
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

Its good to know that its working. Well these are the response headers that I use to prevent caching



SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
All other cache-control fields are pointless when no-cache is specified.
Mark Williams
Ranch Hand

Joined: Aug 01, 2008
Posts: 66
My question probably depends on the client but, what effect do these no cache headers have on images referenced in the HTML? It should be none right? I am thinking that the no cache header only applies to the HTML and not the objects that the HTML tells the browser to request.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Images are obtained by fully separate and independent requests fired by the webbrowser itself after examing the 'src' attribute.
Mark Williams
Ranch Hand

Joined: Aug 01, 2008
Posts: 66
Bauke Scholtz wrote:Images are obtained by fully separate and independent requests fired by the webbrowser itself after examing the 'src' attribute.


So, I will assume that the headers are not stopping the browser from caching images on the page. Thanks.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Indeed. The response headers only applies on the current request/response and certainly not on others.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with browser caching