File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes trying to disable back in a struts-based app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "trying to disable back in a struts-based app" Watch "trying to disable back in a struts-based app" New topic

trying to disable back in a struts-based app

Sue Pillai
Ranch Hand

Joined: Nov 04, 2004
Posts: 89
This could be a javascript post, but I thought it better to post it here since I am guessing it is more of a struts-related issue. I am trying to disable the back button, by repainting the current page when a user clicks back. This, I am doing, using the infamous "window.history.forward(1)" While it works well and serves the purpose in most parts of my app, there are some places where it does not do the trick.

I have a search page, where I enter some search criteria and click submit. This calls a struts action class and the search results are then being painted on a jsp. It is this search results page that I am unable to repaint. Meaning if I click back button on this page I am getting a "page cannot be found (server/dns error)"

At this point what is interesting is that if I press enter at the address bar or refresh, I am able to see the page again and clicking a back there on works as expected. It is when I first come onto the search results page that my back click fails.

Has anybody come across such a problem. Right now, since the app is in the stage of completion, I do not have a choice to redesign the entire app (like synchronizer token pattern, etc..) Also for all those against disabling the back button...I have no choice there client wants it and I need to give it.

I greatly appreciate any thoughts and suggestions for my problem. Thanks.


SCJP 1.2
I agree. Here's the link:
subject: trying to disable back in a struts-based app