How to escape f:selectItem itemLabel attribute

How to escape f:SelectItem itemLabel attribute so that I can add a hyperlink in the label?

Using following code, I was able to escape h:outputText but not f:selectItem.

            <h:outputText value="MyLink &lt;a href=&quot;http://google.com&quot; &gt;Google &lt;/a&gt;" escape="false"/>              
            <h:selectOneRadio id="p" value="#{bean.somevalue}" required="true" >
                <f:selectItem escape="false" escapeItem="false" itemLabel="One &lt;a href=&quot;http://google.com&quot; &gt;Google &lt;/a&gt;" itemValue="O" />
                <f:selectItem escape="false" escapeItem="false" itemLabel="Two &lt;a href=&quot;http://stackoverflow.com&quot; &gt;Stackoverflow&lt;/a&gt;" itemValue="T" />
            </h:selectOneRadio>

I want something as in following image

enter image description here


Solution 1:

This is a documentary bug in JSF. The actual attribute is named itemEscaped, not escapeItem (as incorrectly documented in VDL) or escape (which Eclipse autocomplete indeed autosuggests for some unknown reason, but is actually totally absent in VDL).

The following construct should work for you (at least, it does for me on Mojarra 2.1.17):

<h:selectOneRadio>
    <f:selectItem itemEscaped="false" itemLabel="One &lt;a href=&quot;http://google.com&quot; &gt;Google &lt;/a&gt;" itemValue="O" />
    <f:selectItem itemEscaped="false" itemLabel="Two &lt;a href=&quot;http://stackoverflow.com&quot; &gt;Stackoverflow&lt;/a&gt;" itemValue="T" />
</h:selectOneRadio>