0
votes

How do I escape f:selectItems itemLabel to use HTML markup? Below is the code

<h:selectManyListbox 
    id="geographicLoc"
    value="#{handlerBean.selectedGeographicLoc}">
    <a4j:ajax event="change" render="citiesID" status="newState" />
    <f:selectItem 
        itemLabel="All &nbsp; All" 
        itemValue="All" itemEscaped="false"/>
    <f:selectItems 
        value="#{handlerBean.geographicLocList}" 
        itemEscaped="false"/>
</h:selectManyListbox>

The attribute itemEscaped is working for f:selectItem but not for f:selectItems.

In backingbean, geographicLocList is of type SelectItem list and I am trying to add  in java as below

final SelectItem selectItemS = new SelectItem();    
selectItemS.setLabel("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
                        + country.getStateDesc());
selectItemS.setValue(country.getStateCode());
geographicLocList.add(selectItemS);
1

1 Answers

4
votes

As per the <f:selectItems> tag documentation, you need the itemLabelEscaped attribute for this.

<f:selectItem ... itemEscaped="false" />
<f:selectItems ... itemLabelEscaped="false" />

See also: