struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <jeromy.ev...@blueskyminds.com.au>
Subject Re: OGNL
Date Thu, 08 May 2008 10:41:43 GMT
Adam Hardy wrote:
> Jeromy Evans on 08/05/08 09:26, wrote:
>> Adam Hardy wrote:
>>> Hi,
>>>
>>> when the Params interceptor populates my entity beans, it must be 
>>> setting the member variables directly without using the setters.
>>>
>>> Is there a way to tell it to use the setters? There is some logic in 
>>> the setters which it would be good if it executed.
>>>
>>
>> Hi Adam,
>> It gives precedence to the setters. Why would it not be able to see 
>> or set the property?
>
> Really? That's good to know - any work-around was looking distinctly 
> horrific.
>
> These are JPA pojos, so the setters should be available.
>
> Maybe it's breaking the javabean spec in some subtle way - I 
> double-checked the memvar, getter, setter and constructor though and 
> it looks OK.
>
> Could it be the way I am using converters?
>
> I set up a converter to instantiate an entity bean, rather than doing 
> it in the ModelDriven interceptor. Could that force OGNL to set its 
> fields directly rather than using its setters?
>
I'm not sure.  I ran into this same issue recently and cursed at lot at 
OGNL only to find out it was caused by erasure of the generic type (ie. 
the class of the setters argument was Object, not what I thought).  It's 
worth debugging this with a breakpoint.  The OGNL implementation is 
quite straight-forward in the way it searches for 
properties/methods/members matching the right signature. As it loops 
through all the properties you should see why it missed the one it 
should have set.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message