On Wed, 26 Mar 2014 08:25:40 -0300, Davide Vecchi <d...@amc.dk> wrote:
1) I have a getter that might cause an error.
2) This getter gets called for the first time by Tapestry, during page
rendering (because its value must already appear in the page, before any
possible user action).
3) If this getter causes an error when called during page rendering, I
want a message to be shown in the rendered page.
It looks to me like the "normal" way to do that is to manually call all
the getters from setupRender, so that if some of them cause errors, I
can set the messages into the corresponding properties while I'm still
in the setupRender method, so these properties will appear in the
rendered page.
You can try adding an onException(Exception e) method to your class. It'll
be called when any exception happens.
In addition, you can call the getters from setupRender(), but annotate the
getters with @Cached, so they'll actually be called just once per request.
From the second call on, Tapestry will return the result of the first
without actually running the body of your method.
Anyway, maybe you should rethink the way you handle your exceptions.
Shouldn't they be treated inside the getter methods themselves?
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org