You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Filip Balas <fb...@gmail.com> on 2005/05/13 00:29:26 UTC
Abort render?
Hi All,
Is there a way to abort a render in the middle of a form rewind?
I am using the 'For' component from T-deli and when the following
situation occurs, I want the render to abort and an error message
to be displayed:
User-A loads a page with a form list of books.
User-B loads the same list.
User-A buys a book, effectively removing it from the inventory.
After User-A checks the book out, but before User-B refreshes
his screen he tries to reserve the book (modifying the record)
but the record no longer exists.
Now the 'For' component prevents a stale link exception from
occurring, but when the Form is rendering itself again, it tries
to render the now-null record and retrieve it's primary key. I
can catch the exception, but I want tapestry to abort the render
and reload the page from scratch while setting an error message:
"Another user has removed the record you were working with"
Is there any way to achieve this?
Filip
PS
I tried to throw a pageRedirectException() but tapestry just
displays the exception instead of re-directing the page.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Abort render?
Posted by Geoff Longman <gl...@gmail.com>.
Why not just add a string property to the page and set it to your
message when this situation occurs?
ie.
(in page Spec)
<property-specification name="error" type="java.lang.String" persistent="no"/>
In java:
public abstract setError(String message);
Then just catch your exception and call setError("Another user has
removed the record you were working with");
In the page template
<span jwcid="@Conditional" condition="ognl:error">
<span jwcid="@Insert" value="ognl:error"/>
</span>
On 5/12/05, Filip Balas <fb...@gmail.com> wrote:
> Hi All,
>
> Is there a way to abort a render in the middle of a form rewind?
> I am using the 'For' component from T-deli and when the following
> situation occurs, I want the render to abort and an error message
> to be displayed:
>
> User-A loads a page with a form list of books.
> User-B loads the same list.
>
> User-A buys a book, effectively removing it from the inventory.
> After User-A checks the book out, but before User-B refreshes
> his screen he tries to reserve the book (modifying the record)
> but the record no longer exists.
>
> Now the 'For' component prevents a stale link exception from
> occurring, but when the Form is rendering itself again, it tries
> to render the now-null record and retrieve it's primary key. I
> can catch the exception, but I want tapestry to abort the render
> and reload the page from scratch while setting an error message:
> "Another user has removed the record you were working with"
>
> Is there any way to achieve this?
> Filip
>
> PS
> I tried to throw a pageRedirectException() but tapestry just
> displays the exception instead of re-directing the page.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org