This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Getting confuse on Struts action call when I click back button

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!