You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by sorinev <so...@gmail.com> on 2015/06/16 20:23:02 UTC

CompoundPropertyModel: override method or catch exception

To go with my  other thread
<http://apache-wicket.1842946.n4.nabble.com/TextField-AjaxEventBehavior-onBlur-onEvent-tp4671150.html>  
about the same form page, I have an issue with the CompoundPropertyModel.
There is a TextField in a form on this page, and the corresponding setter in
the model can throw an exception. When it does, wicket crashes the page. It
seems that it's using reflection by grabbing the name of the component on
the page, and looking for a setter for that component in the model
automatically behind the scenes.

What I need to have happen is either I can somehow override that method
through the CompoundPropertyModel, or just catch exceptions from the model
in general, or maybe some other mechanism. In any case, what I need is to be
able to cleanly reset things on the page in the case of an exception rather
than the page crashing altogether. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/CompoundPropertyModel-override-method-or-catch-exception-tp4671205.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CompoundPropertyModel: override method or catch exception

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Then you need to roll your own IModel and use it instead of
CompountPropertyModel.
**PropertyModel classes use reflection to find and call the setter and
getter methods.

Martin Grigorov
Freelancer. Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Jun 16, 2015 at 9:23 PM, sorinev <so...@gmail.com> wrote:

> To go with my  other thread
> <
> http://apache-wicket.1842946.n4.nabble.com/TextField-AjaxEventBehavior-onBlur-onEvent-tp4671150.html
> >
> about the same form page, I have an issue with the CompoundPropertyModel.
> There is a TextField in a form on this page, and the corresponding setter
> in
> the model can throw an exception. When it does, wicket crashes the page. It
> seems that it's using reflection by grabbing the name of the component on
> the page, and looking for a setter for that component in the model
> automatically behind the scenes.
>
> What I need to have happen is either I can somehow override that method
> through the CompoundPropertyModel, or just catch exceptions from the model
> in general, or maybe some other mechanism. In any case, what I need is to
> be
> able to cleanly reset things on the page in the case of an exception rather
> than the page crashing altogether.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/CompoundPropertyModel-override-method-or-catch-exception-tp4671205.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>