Win a copy of Fixing your Scrum this week in the Agile forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Getting confuse on Struts action call when I click back button

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I do any operation, that means send a request to struts action
Ex: /emailFriend.do is called and sent an email successfully and then the next page is displayed(forward success). (the URL bar is showing xxx/emailFriend.do).

Now from this page, I clicked on one link to another page and went. from that page I click on browser back button then once again /emailFriend.do is called and once again the email is sent. this is absolutely wrong. how can I avoid this?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the forward that is used immediately after the email is sent, specify redirect="true". This will make it so the URL bar does not show as xxx/emailFriend.do, and therefore pressing the back button will never cause the email to be sent.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you merill,

I did the same earlier and working successfully in my server (IBM WAS 6.0), when I deployed my application in test server (same version), I see the browser exceptions saying can not find resource /xxx/xxx/EmailConfirmation.jsp", but the email has sent successfully?

Do i need to do any changes in admin console of WAS?

Now I did some other way to avoid double submission

i.e. I put a hidden field with current time millis and I m verifying before doing the operation in action class. Now its not doing recurring and it simply avoiding. working good. is that ok?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic