jsr344-experts@javaserverfaces-spec-public.java.net

[jsr344-experts] Re: converters for checkboxes

From: Kito Mann <kito.mann_at_virtua.com>
Date: Tue, 28 Feb 2012 08:22:32 -0500

On Mon, Feb 27, 2012 at 11:54 AM, Edward Burns <edward.burns_at_oracle.com>wrote:

> >>>>> On Wed, 22 Feb 2012 09:03:53 -0500, Kito Mann <kito.mann_at_virtua.com>
> said:
>
> KM> Sure -- I'd like SelectOneBoolean to support converters just like every
> KM> other JSF input component :-).
>
> Your email leaves some ambiguity for me. Let's look at this from the
> page author perspective. Which of these do you mean?
>
> <h:selectBooleanCheckbox />
> <h:selectManyCheckbox />
>

<h:selectBooleanCheckbox/>


>
> Note that the by-type conversion already does cause the correct
> converter to be activated.
>
> Also, both of the preceding tags do support converters as usual.
>

I beg to differ. Take a look at this code from CheckBoxRenderer in Mojarra:

    @Override
    public Object getConvertedValue(FacesContext context,
                                    UIComponent component,
                                    Object submittedValue)
    throws ConverterException {

        return ((submittedValue instanceof Boolean)
                ? submittedValue
                : Boolean.valueOf(submittedValue.toString()));

    }


Compare this to HtmlBasicInputRenderer.getConvertedValue().


> --
> | edward.burns_at_oracle.com | office: +1 407 458 0017
> | homepage: | http://ridingthecrest.com/
>