You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nancy Lin <co...@yahoo.com> on 2005/05/10 20:38:38 UTC

Browser Refresh & Reload

All,

I have a button action named "reset".  The busines requirement for
reset buttion are:

  a)  Roll back the changes if reset button is clicked
  b)  If user modify something data and causes error, the reset
      button will act like a cancel button and remain on the same 
      page.

This "Remain on the same page" is something like reload.  I need to
be able to reload the page with it's original information, not the
information modified that causes the error.


Any suggestions?

P.S.  This is like chaining action, but instead of calling a
different action, I want to reload the same action.

Thanks.
Nancy.


		
Discover Yahoo! 
Find restaurants, movies, travel and more fun for the weekend. Check it out! 
http://discover.yahoo.com/weekend.html 


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


Re: Browser Refresh & Reload

Posted by Michael Jouravlev <jm...@gmail.com>.
Same stuff different day. I hope I will not be accused in
self-advertising again ;)

Anyway, here is how I solve this problem:
* There is permanent storage (database)
* There is business object, which can be loaded from database.
* There is a temporary area in the session ("current item")
* "Current item" contains a _working copy_ of persistent business
object (along with messages, more on them further). Current item is
the one that you are editing or viewing.
* There is a form, which does not care, where the data that it shows,
comes from. All it knows, that when is receives object ID, it must
show object's data.
* When form receives object ID, it checks "current item" first. If it
has object with needed ID in it, form uses object's properties.
* If object with needed ID is not loaded in "current item", then
current item is discarded (cuurently just one per session, per EDIT or
VIEW operations), object is loaded from database into current item,
and copied to the form bean.
* When reset is clicked, current item is reloaded from database, then
page is refreshed (with current data, as you may have guessed)
* When Cancel is clicked, current item is disposed, database is not affected.

Oh, yeah, and the cherry on the cake:

* error messages are stored in the "current item" along with business
object, but messages themselves are not part of persistent object.
* each time page is reloaded, messages are redisplayed
* when changes are reset or canceled, messages are cleared.

Check out this link: http://www.superinterface.com/rdapp/viewList.do
Granted, it does not have reset, but to add it would be a ten-minute
deal. Click "edit", try to enter some non-integer stuff. Try to
reload, see, messages are reloaded as well. Then click Back, see that
you return to the list _immediately_. You do not need to click Back as
many times, as many times you entered wrong data. Then you can edit
the same item again, or just click Forward. See, it is the same old
item, reloaded. Back/Forward is like reset. Adding explicit reset
processing will be really simple.

I don't want to share the source code now, since I am about to
overhaul it and to release together with dialog/wizard library.
Hopefully, no more than two weeks.

Michael.

On 5/10/05, Nancy Lin <co...@yahoo.com> wrote:
> All,
> 
> I have a button action named "reset".  The busines requirement for
> reset buttion are:
> 
>   a)  Roll back the changes if reset button is clicked
>   b)  If user modify something data and causes error, the reset
>       button will act like a cancel button and remain on the same
>       page.
> 
> This "Remain on the same page" is something like reload.  I need to
> be able to reload the page with it's original information, not the
> information modified that causes the error.
> 
> Any suggestions?
> 
> P.S.  This is like chaining action, but instead of calling a
> different action, I want to reload the same action.
> 
> Thanks.
> Nancy.

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