Thanks for your reply Simon.

I tried what you suggested, however it didn't seem to work. I looked in the
myfaces-api-1.1.5-SNAPSHOT-sources.jar and
myfaces-impl-1.1.5-SNAPSHOT-sources.jar files but did not find .tld files. I
use facelets in my project and I also did not find taglib.xml files either.
How should I go about determining what component the facelet
<h:selectOneRadio> tag uses? And what exactly are the names of the
configuration files that I should be looking for?

Any help would be much appreciated!!



On 1/11/07, Simon Kitching <[EMAIL PROTECTED]> wrote:

Wendy Chou wrote:
> Hi,
>
> I would like to render radio buttons differently to include the "for"
> attribute in the label tag. So when I do this:
>
> <h:selectOneRadio>
>     <f:selectItem value="#{bean.options}" />
> </h:selectOneRadio>
>
> I want this set of radio buttons would render like so:
>
> <label for="radio1">
>     <input type="radio" id="radio1" value="Y" />Yes
> </label>
> <label for="radio2">
>     <input type="radio" id="radio2" value="N" />No
> </label>
>
> Currently I have extended the HtmlRadioRenderer class in the
> org.apache.myfaces.renderkit.html.ext package. However I'm not sure how
> to configure my faces-config so that all <h:selectOneRadio> tags would
> use my extended renderer.
>
> My main concerns are the <component-family> and <render-type> tags, as
> I'm not sure what values to set them to. I tried doing:
>
> <renderer>
>             <component-family>myRadio</component-family>
>             <renderer-type>org.apache.myfaces.Radio</renderer-type>
>
> <renderer-class>com.my.example.extendedHtmlRadioRenderer
</renderer-class>
> </renderer>
>
> and
>
> <renderer>
>             <component-family>myRadio</component-family>
>             <renderer-type>javax.faces.Radio</renderer-type>
>
> <renderer-class>com.my.example.extendedHtmlRadioRenderer
</renderer-class>
> </renderer>
>
> but none worked.
>
> Has anyone already gotten this to work, or perhaps can someone give me
> suggestions as to what I should try?

As can be seen in the .tld file, h:selectOneRadio is handled by
org.apache.myfaces.taglib.html.HtmlSelectOneRadioTag.

This tag class shows clearly that it uses renderer-type of
"javax.faces.Radio".

The actual component type is javax.faces.HtmlSelectOneRadio, and
inherits its COMPONENT_FAMILY from parent class UISelectOne, which
defines it as "javax.faces.SelectOne".

So:
   <renderer>
     <component-family>javax.faces.SelectOne</component-family>
     <renderer-type>javax.faces.Radio</renderer-type>
     <renderer-class>....</renderer-class>
   </renderer>
should work for you.

Regards,

Simon

Reply via email to