• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

REFRESH A JSP PAGE

 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to update a record in a JSP page which first fetch record from database, you make the relevant changes and on submit , It updates the record in the database. Now the problem is when I load this JSP page and ask it to show the specific record , It is showing the same old values as good as the previous JSP page.
I have performed the query on the database and found that changes have been updated. This seems to be a problem in refreshing the JSP page. Can someone tell how to refresh a JSP page ?
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use some event on which u want to refresh your page
and on that javascript event call method
history.go(0)
and browser will refresh your JSP page
hope it helps
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Gaurav,
Thanks for the reponse.
I have tried to invoke the function in which I have embedded history.go(0) in onLoad event of the body tag.
The partial code is as follows :

function Refresh() {
history.go(0);
}

</script>
</HEAD>
<BODY BGCOLOR="F0FFFF" TEXT="00BFFF" onLoad="javascript:Refresh()">
Now, When I tried to load this jsp page it seems to go in a infinite loop kind of situation. I think , What is happenning that when body is getting loaded it invokes history.go(0) and It calls itself again which again loads the body which again invokes the javascript function and so on and so forth. Have I gone wrong somewhere. I have got only submit, reset and a back button in this JSP page. So the only way , I can refresh this JSP page is when it is getting loaded . Is there some other event which you can think of in which this javascript function Refresh() can be called ?
regards
Ravindra
 
ravindra janapreddy
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My problem is quite similat to the problem faced by Sanjay Patel. He has also posed a similar question in this forum. Please refer to it as well. The problem will be clearer.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry to say that calling any refresh function on body onLoad will not help much. It may rather increase the difficulty levels. Because every time the page gets loaded it gets refreshed by that function and again the page is loaded and again the function is called and.... this process goes into the infinite loop.
Try using <%response.setHeader("Cache-Control","no-cache");%>
in your JSP before anything. Place this code before anything in JSP on the top at line number 1. It might help. I hope.
------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic