aspose file tools*
The moose likes Servlets and the fly likes Refreshing pages 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 » Servlets
Bookmark "Refreshing pages" Watch "Refreshing pages" New topic
Author

Refreshing pages

Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
I'm finding that some of my jsp pages are refreshing when I go back into them. Is there any way I can force a refresh w/out having the user have to adjust their browser to ALWAYS refresh?


By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
hi dear
u can use "refresh" header in your doc. this way your user will not hv to press refresh everytime.
hth
MB
[ October 09, 2002: Message edited by: malhar barai ]

Malhar Barai
SOA & Java Book
Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
How might they go about doing this?
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
Originally posted by Dale DeMott:
How might they go about doing this?

response.setHeader("Refresh","5");
hth
malhar
Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
So in doing so.. first time in the page will refresh immediatly? What will happen the second time in. (after the refresh)
-Dale
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
Originally posted by Dale DeMott:
So in doing so.. first time in the page will refresh immediatly? What will happen the second time in. (after the refresh)
-Dale

buddy,
you can generate some flag for some business login, & for that particular value of flag u can refresh.
suppose fr the first time u want the page to be refreshed immediately & fr subsequent access u wud like to refresh after more time, then u cud write some logical stmts, set the flag & refresh.
or in refresh header u can specify the time after which the page has to be refreshed, instead of 3 cant u put 300...wouldnt that help...??
MB.
Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
Hmm supose I can do that. Would like to find a more elegant way. (if ya know what I mean). I do understand what you're saying.
Rick Hightower
Author
Ranch Hand

Joined: Feb 20, 2002
Posts: 350
set the header pragma no cache.
pseudo code:
response.setHeader("PRAGMA","NO-CACHE");
or add <HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"/> to your JSP
this will work with http 1.1 and http 1.0
it tells the browser not to cache your page.
that your page is dynamic and it should get it from the server every time.
note that <HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"/> will not work with IE 5.0 and below...
enjoy


Rick Hightower is CTO of Mammatus which focuses on Cloud Computing, EC2, etc. Rick is invovled in Java CDI and Java EE as well. linkedin,twitter,blog
Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
Good to know (about the browser compatibility) Thanks for the info. This will work great.
-Dale
Matt Horton
Ranch Hand

Joined: Feb 06, 2002
Posts: 107
Not to get off topic... but can people type w/ complete words? I go cross-eyed trying to read some of these posts...
dude, sick! tite brah! I cud code dis won servlet, wuddup!
-or not-
just a suggestion.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Refreshing pages