Another stupid question: there is no getPageService() in T4's BasePage...
Where do I get the ILink from?
Thanks,
MARK
Martin Strand wrote:
Hi Mark.
If you make your form listener return an ILink, tapestry will redirect
the client to the new URL and any subsequent "refresh" will only
reload that page, not submit the form again.
Simple example:
public ILink submit()
{
addStuffToDatabase();
return getPageService().getLink(false, "YourResultPage");
}
@InjectObject("engine-service:page")
public abstract IEngineService getPageService();
You can also throw a RedirectException if you want, it sends a HTTP
redirect to the client. You're thinking of a PageRedirectException,
which is handled internally.
Martin
On Mon, 10 Apr 2006 01:47:51 +0300, Mark <[EMAIL PROTECTED]> wrote:
Hi,
I just searched for a solution for this problem in the archive, but
did not find anything that seemed to work:
Assume I have a request that adds or deletes a record to/from the
database. The request gets executed, record gets added or deleted and
a comfirmation is displayed.
If the user now hits the F5 key or the "Reload" or "Refresh" button
of the browser, the request is sent to the server again, causing the
record to be added or deleted (which will of course fail since the
record is already gone) again.
I did find a number of posts regarding this, but most of them ended
in the recommendation to use a RedirectException in the add/delete
page after the add/delete has been performed. However, I do not see
how this would help, since the RedirectException is executed
internally by Tapestry, not by the Browser.
This post here describes how to reproduce the problem using the VLib
project that comes with Tapestry:
http://article.gmane.org/gmane.comp.java.tapestry.user/7224/match=browser+refresh
This post seems to have a solution, but it is quite complex and
outdated (from 2003), so I am wondering if T4 has a better solution
in the meantime?
http://article.gmane.org/gmane.comp.java.tapestry.user/3580/match=contribute+action+link
Thanks,
MARK
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]