• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Redirecting to jsp without caching the data

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow... ! Nobody is here to help.... great....
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.....
 
reply
    Bookmark Topic Watch Topic
  • New Topic