aspose file tools*
The moose likes Struts and the fly likes Redirecting to jsp without caching the data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Redirecting to jsp without caching the data" Watch "Redirecting to jsp without caching the data" New topic
Author

Redirecting to jsp without caching the data

Bhavesh Sangwan
Ranch Hand

Joined: Aug 08, 2012
Posts: 57
I coded a JSP which is processed by an Action and then redirected back to same JSP on success/failure. Actually this jsp inserting data into database successfully and returning to the same jsp happily after insertion...

but


when I press refresh button after returning, it inserts previous data again into database even without clicking on submit button. And I noticed that when I'm coming on same JSP after successful insertion, it doesn't change its URL as it was in very first request....

my jsp url is- http://localhost:8080/ManageMyAccounts/manage_account.jsp

and after clicking on submit button, it inserts record in DB and return on same jsp but with URL- http://localhost:8080/ManageMyAccounts/transaction.do

and now if I press F5/ refresh button, it again inserts that previous data into DB...

So how to handle this ?

I made my best efforts explaining my problem to you. I hope you understood what I want. Now Please help....

Thanks..!
Bhavesh Sangwan
Ranch Hand

Joined: Aug 08, 2012
Posts: 57
Wow... ! Nobody is here to help.... great....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
It sounds as if the form submit uses a GET, not a POST, or otherwise it should have popped up a dialog asking you to confirm that you want to resubmit the form.

It also sounds as if you're not using the Post-Redirect-Get pattern after the form submit.


Ping & DNS - my free Android networking tools app
Bhavesh Sangwan
Ranch Hand

Joined: Aug 08, 2012
Posts: 57
JSP code


Action Mapping in struts-config


Action class


And URL of jsp page is also not changes after redirecting after action completed.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Redirecting to jsp without caching the data