struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <andrew.david.h...@gridnode.com>
Subject RE: Beating the REFRESH button.
Date Mon, 19 Aug 2002 14:35:23 GMT
Try changing the forward to your view.do in the struts-config to have
redirect="true".
This should result in refresh refreshing the url you end up at rather than
the save.do

ie:
<forward  name="mysteryMachine" path="/scooby.do?where=ru" redirect="true"/>

(nb: redirecting this way will result in no parameters that were submitted
to save.do being passed back to view.do, which could be a very bad thing
depending on what you are doing (or it could be a good thing))

-----Original Message-----
From: Ray [mailto:ray_offiah@yahoo.co.uk]
Sent: Monday, August 19, 2002 22:11
To: struts-user@jakarta.apache.org
Subject: Beating the REFRESH button.


Hello there again.

I have a small problem with users hitting the refresh button whilst doing
things with my application. Here's the scenario:

User accesses view.do - an action which displays a list of data items,
along with buttons to add, delete and edit data.  If the add information,
and it is validated as correct, then the data is written to the database
with the action savedata.do, and the struts-config.xml redirects back to
view.do to display the new list.

The problem is that the last thing in the browser's URL window, is save.do
(I imagine because servlet redirection does not update the browser's
history list); so if the user hits refresh, the savedata.do action is
executed again.

Is there a tried and tested way to prevent this sort of thing happening.
I'm thinking that I could call a plain HTML file that calls up event.do
from JavaScript; that way, it will be written into the browser's history
list.

Would that be the best way to go about it, or does someone have a tidier
suggestion ... ? ... :-)


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message