wood burning stoves 2.0*
The moose likes JSP and the fly likes reload the jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "reload the jsp page" Watch "reload the jsp page" New topic
Author

reload the jsp page

Shaik Vali
Greenhorn

Joined: Feb 07, 2008
Posts: 22
Hi , I need to reload the jsp page even I clicks the browser's navigation (back & forward)buttons , please give the solution.
nuthan kumar
Ranch Hand

Joined: Feb 14, 2006
Posts: 47
try using this javascript in your page, this will disable Back button
<script language="JavaScript">
<!--
javascript:window.history.forward(1);
//-->
</script>
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You can't disable the back button and this will not solve the original poster's issue.

Look in our JSP FAQ for articles on no-cache headers and the Post-Redirect-Get pattern. The combination of these two things will greatly reduce the likely hood that someone will back into a page with stale data on it.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
nuthan kumar
Ranch Hand

Joined: Feb 14, 2006
Posts: 47
adding client-side JavaScript code on the page that we do not want to let the user return to, gives effect of hitting the forward button, which would counter any action by a user clicking the back button and user will see same page even after clicking back button.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

This technique amounts to a cheap parlor trick and is extremely annoying to the end user. It doesn't work if the user disables Javascript and can easily be defeated with scripts written for the GreaseMonkey plugin for Firefox.

The user's browser is theirs and the developer of a particular app or page has no business tinkering with the way it works. Think of your app as a guest in the user's house. Make sure it can handle back button and refresh button clicks gracefully instead of trying to defeat them.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: reload the jsp page
 
Similar Threads
reload opner window javascript
Page Reload / Frame
AJAX requests on page reload
run other jsp without reload current page
saveMessages and session