You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Jouravlev <jm...@gmail.com> on 2005/09/20 18:32:04 UTC
Re: form resubmission on refreshing page
On 9/20/05, temp temp <mi...@yahoo.com> wrote:
> I have a list in my jsp .For each item in the list I
> have a submit button through which user can remove an
> item in list. When user clicks on remove link I submit
> the form to my action class .Action class removes
> selected item from the collection and then sends him
> back to the same page . After the page is loaded if
> user clicks on refresh for some reason the same
> action is repeated again ie one more item is deleted
> from list .How can I avoid this?
In your <forward> element you need to use redirect="true" to decouple
input and output phases. Therefore, you need to stick your ArrayList
into the session. Why not then set ActionForm scope to "session" and
to set ArrayList as nested property of your ActionForm?
This article may help you to understand what is going on (sorry for a
somewhat patronizing style and bad grammar):
http://www.theserverside.com/articles/article.tss?l=RedirectAfterPost
Also play with this online demo:
http://www.superinterface.com/strutsdialog/crudactionlite.do
More demos here:
http://www.superinterface.com/strutsdialog
If you like it, you may want to check out Struts Dialogs library:
http://struts.sourceforge.net/strutsdialogs
This is the most important class of the library:
http://struts.sourceforge.net/strutsdialogs/dialogaction.html
Michael
----
Struts Dialogs:
http://struts.sourceforge.net/strutsdialogs
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org