getValue() also works with raw input, not just the boolean model object

imagine this

you have a checkbox that starts out unchecked

you check it

submit the form

a validator fails, so Boolean.TRUE never makes it into the checkbox model

when the checkbox repaints, if it didnt do what it does now and use the
model as you suggest it would repaint _unchecked_ which is of course very
wrong.

furthermore strings.true() doesnt need to be localized, no matter what
locale your browser is in submit values such as "on" are not localized.

-igor




On 2/5/07, Martin Benda <[EMAIL PROTECTED]> wrote:

Hi,

why is the boolean model value of a CheckBox converted to a String and
again
to a boolean (using Strings.isTrue) inside CheckBox#onComponentTag?

boolean -> getValue() -> String -> Strings.isTrue() -> boolean

Calling (getModelObject() == Boolean.TRUE) should be IMHO sufficient.

Since Strings.isTrue(...) is hard-coded and cannot be localized, you will
run
into problems if you provide your own custom BooleanConverter which
converts
localized strings.

WDYT?

Regards,
Bendis

Reply via email to