• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting confuse on Struts action call when I click back button

 
Simpson Kumar
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?
 
Merrill Higginson
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic