File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Browser Refresh Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Browser Refresh" Watch "Browser Refresh" New topic

Browser Refresh

Rohit Prasad

Joined: Sep 05, 2006
Posts: 12
How can I detect in my Action when user clicked refresh button from browser?

Thanks for any help.

saivenu madhav

Joined: Nov 15, 2007
Posts: 29
Hello friends,

I have a problem which i am trying to resolve but not able to do so. Any help in this regard would be appreciated.

I have a jsp page (x.jsp) which has an "Add" button. On click of Add button, another popup jsp page (y.jsp) would open that would list the users details like firstname, middlename, lastname, email etc.. I select a record in the popup jsp page and clicks on the OK button. On click of the OK button, the selected record would be placed in the parent jsp page (x.jsp) and the popup jsp page (y.jsp) will close. Now i click the save button on the parent jsp page (x.jsp) which will save the selected user details along with other info on the page.

Now my problem is after successful save, if i click on the refresh button, the recently added user record will again get inserted into the database and now there would be two user records with same info which actually should not happen. Is there any way to avoid database insert on click of the refresh button.

Please help,

Thanks in Advance,

vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Go for savetoken stuff in struts
saivenu madhav

Joined: Nov 15, 2007
Posts: 29
Hi Viday sagar,

I am using single action for inset&Update i.e SaveAction.

Could you please give some code to help the above problem. currenlty i am doing with

But it is not working .

I agree. Here's the link:
subject: Browser Refresh
It's not a secret anymore!