本文介绍了如何转义f:selectItems itemLabel属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何转义f:selectItems itemLabel以使用HTML标记?下面是代码
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 All"
itemValue="All" itemEscaped="false"/>
<f:selectItems
value="#{handlerBean.geographicLocList}"
itemEscaped="false"/>
</h:selectManyListbox>
itemEscaped属性适用于f:selectItem,但不适用于f:selectItems.
The attribute itemEscaped is working for f:selectItem but not for f:selectItems.
在backingbean中,geographicLocList属于SelectItem list类型,我正尝试在Java中添加以下内容
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(" "
+ country.getStateDesc());
selectItemS.setValue(country.getStateCode());
geographicLocList.add(selectItemS);
推荐答案
按照 <f:selectItems>
标签文档,您需要为此提供itemLabelEscaped
属性.
<f:selectItem ... itemEscaped="false" />
<f:selectItems ... itemLabelEscaped="false" />
另请参见:
- 如何转义f:selectItem itemLabel属性
- How to escape f:selectItem itemLabel attribute
See also:
这篇关于如何转义f:selectItems itemLabel属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!