• Post Reply Bookmark Topic Watch Topic
  • New Topic

refresh automatically by back button

 
jawwad ahmed
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi gurus.
Well i have simple jsp page in which i am displaying n items (5 items per page)in same jsp page.
Now the problem is that when i click next button(not browser)it shows next 5 items.
Now when i click back button of browser it show me previous page but it is not refreshed it give exceptions when i add basket becuase beans is not set.So i have to do explicitly refresh.
How i would be possible to refresh button automatically.Will be very thank ful for any help
Jawwad Ahmed
 
yo nara
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jawwad ahmed:
Hi gurus.
Well i have simple jsp page in which i am displaying n items (5 items per page)in same jsp page.
Now the problem is that when i click next button(not browser)it shows next 5 items.
Now when i click back button of browser it show me previous page but it is not refreshed it give exceptions when i add basket becuase beans is not set.So i have to do explicitly refresh.
How i would be possible to refresh button automatically.Will be very thank ful for any help
Jawwad Ahmed
 
yo nara
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
well i haven,t got clear idea but one of the crude method would be you can make use of onLoad() function of <body> tag which calls javascript function which can take refreshed values from bean as it calls the present state of bean and may be when you click back button of browser it gives page from cache memmory and not the fresh one
 
jawwad ahmed
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well its give i/o exception "Page can not be reactivated
I have to refresh page only once when back button is pressed.
Is there is a solution for that.Thanks
Jawwad Ahmed
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
prevent the page from being cached (I don't have the code handy, but I can post it tomorrow), make sure all the page data is present on the URL rather than POSTing or using the session.
Going back should send a fresh request for the page and this should happen automatically since the data is in the URL (as opposed to using POSTed data, where the page must be re-submitted)
Dave.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can ad this to the response header.
response.setHeader("Cache-Control", "no-cache")response.setHeader("pragma", "no-cache") - This one is to support those clients that are using HTTP 1.0 browsers.
 
jawwad ahmed
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David O'Meara
(I don't have the code handy, but I can post it tomorrow)
Well it will be great if u put the code for it. How i will send refresh request on browser back button click.
Thanks.
Jawwad Ahmed
[ August 08, 2002: Message edited by: jawwad ahmed ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's tomorrow
It's just like Bosun said, just with more formatting

Tell us how you get along.
Dave
[ August 08, 2002: Message edited by: David O'Meara ]
 
jawwad ahmed
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well tahnks the code is working.Before the problem was occuring due to putting items in the session object.I have solved this problem by placing all information in javascript.So by doing so i don't have to refresh
Now i want to ask that which is good idea either expires page or put information in script method instead of session object.
thanks
Jawwad Ahmed
[ August 10, 2002: Message edited by: jawwad ahmed ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!