It sounds like you are using a PropertyModel. If so, that is the
"expected" behaviour, provided by the property resolver it employs.
If there is no accessor (getter), the field, even if private is
accessed (fields[i].setAccessible(true);).
This is by design, not a bug, but whether it's a good idea or not is
can be argued. The pragmatic argument for this design decision could
probably be along the lines of - the model object may not have
accessors and you may not have control of the code for it (so how do
you know the private variable exists? And encapsulation?).You could
end up with an app that runs in development and fails in production if
Java security management is configured differently.
So, use with care - in Java "getters" and "setters" are an unfortunate
fact of life, so prefer having accessors and mutators if you have the
choice.

 Regards - Cemal
jWeekend
OO & Java Technologies, Wicket
Consulting, Development, Training
http://jWeekend.com


On 13 May 2010 08:57, Douglas Ferguson <[email protected]> wrote:
> I figured it out.
>
> If the object doesn't have a getter, the setter won't be called, and instead 
> it just injects the value into the field.
>
> That seems like a bug, do I need to prepare a quickstart?
>
> D/
>
> On May 13, 2010, at 2:51 AM, Cemal Bayramoglu wrote:
>
>> Send a QuickStart (simplest one you can create that demonstrates this)
>> and we'll take a look.
>>
>> Regards - Cemal
>> jWeekend
>> OO & Java Technologies, Wicket
>> Consulting, Development, Training
>> http://jWeekend.com
>>
>>
>>
>> On 13 May 2010 08:17, Douglas Ferguson <[email protected]> wrote:
>>> I am seeing some unexpected behavior.
>>>
>>> I have a page with a text field and a link on it.
>>> The text field is backed with a property model
>>> The text field has an AjaxFormComponentUpdatingBehavior on it.
>>>
>>> The link then persists the object that the property model is wrapping.
>>>
>>> I never see the setter get called for the object.
>>> The setter massages the data. I see the raw data, as entered in the 
>>> browser, get stored to my db.
>>> I also never hit my breakpoint int he setter.
>>>
>>> D/
>>> ---------------------------------------------------------------------
>>> 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]

Reply via email to