| Author |
Getting confuse on Struts action call when I click back button
|
Simpson Kumar
Ranch Hand
Joined: Mar 19, 2008
Posts: 260
|
|
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?
|
Thanks,
Kumar
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
|
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.
|
Merrill
Consultant, Sima Solutions
|
 |
Simpson Kumar
Ranch Hand
Joined: Mar 19, 2008
Posts: 260
|
|
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?
|
 |
 |
|
|
subject: Getting confuse on Struts action call when I click back button
|
|
|