Re: Refresh Causes Database Update
Re: Refresh Causes Database Update
- Subject: Re: Refresh Causes Database Update
- From: Guido Neitzer <email@hidden>
- Date: Sun, 22 Apr 2007 21:13:43 -0600
On 22.04.2007, at 19:26, Drew Thoeni wrote:
I have some code (below) that functions as expected. However, I
just noticed when the user has completed this method, and is
returned to the nextPage, if they refresh the nextPage the database
is updated again with the same selections that were made in this
method.
I'm pretty sure this is something I'm doing incorrectly. And am
hoping it's obvious to you long-timers. Thoughts? (Other comments
on my code is also, always, welcome.)
When the user does a "reload" the same action is called again,
because the same URL is loaded. So, if you want to avoid that, an
easy way is to have a "saved" flag which you set to true after you
have saved your ec.
The problem with all that kind of stuff is, that you have to be
aware, that you will have users using the back button, using browser
reload and so on. You have to find a way to deal with that. It
depends on you app what you can do about that.
If you want to simply handle a reload, you might override
"invokeAction", check the incoming request uri against the one from
the last request, and return the last action result if it is the same
request. Be aware, that with that a reload of the page will always
show the the same result, it will not show up, when something has
changed between calls. Also you have to cache the last action result,
which might blow up the memory usage of your session.
There a many different ways of handling these problems. Search on
Google for "Browser backtracking" and you'll find several tips &
tricks and explanations for the problems involved.
cug
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden