Restrict referesh from resending the request

2006-09-16 Thread Puneet Lakhina

Hi,
I think i maybe have my basics skewed, but this is what my problem is.
I have a form that on submit submits to an action which forwards to a page
which shows the page displaying that the submit was successful. Now if the
user presses refresh at that page the form is resubmitted and it creates an
incorrect entry.

Is there sum way I can restrict this.
Should i forward to a different action(say Action2) from the action (say
Action1)which handles the submit, and then Action2 would then forward to the
successful submit page?

--
Puneet


Re: Restrict referesh from resending the request

2006-09-16 Thread Nuwan Chandrasoma

Hi,

I had the same problem. so what i did was.., i created an forward action 
mapping (no action code is required for this) and when the submit button is 
click it would call the action mapping which has the action class that that 
would do the real process and the success forward would call the forward 
action mapping that i have said above with the redirect tag set to true.., 
so that when the processing is finish the address bar URL would change to 
this forward action mapping(a dummy one which is not wired to a action 
class). so that even if the user click refresh button he would only see the 
page that was loaded.


eg in struts-config.xml

 action path=/dummyForward forward=/Results.jsp/


 action name=MyForm path=/realAction scope=request
 type=foo.boo.action.MyAction validate=false 
  forward name=success path=/dummyForward.do redirect=true/
 /action

hope this would help.

Thanks,

Nuwan


- Original Message - 
From: Puneet Lakhina [EMAIL PROTECTED]

To: Struts Users Mailing List user@struts.apache.org
Sent: Saturday, September 16, 2006 5:01 PM
Subject: Restrict referesh from resending the request



Hi,
I think i maybe have my basics skewed, but this is what my problem is.
I have a form that on submit submits to an action which forwards to a page
which shows the page displaying that the submit was successful. Now if the
user presses refresh at that page the form is resubmitted and it creates 
an

incorrect entry.

Is there sum way I can restrict this.
Should i forward to a different action(say Action2) from the action (say
Action1)which handles the submit, and then Action2 would then forward to 
the

successful submit page?

--
Puneet




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]