How to escape f:selectItem itemLabel attribute

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>

Leave a Comment