Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirecting to jsp without caching the data

 
Bhavesh Sangwan
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow... ! Nobody is here to help.... great....
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bhavesh Sangwan
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP code


Action Mapping in struts-config


Action class


And URL of jsp page is also not changes after redirecting after action completed.....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic