如何转义f:SelectItem itemLabel属性,以便我可以在标签中添加超链接?
使用以下代码,我能够逃脱,h:outputText但没有f:selectItem.
<h:outputText value="MyLink <a href="http://google.com" >Google </a>" escape="false"/>
<h:selectOneRadio id="p" value="#{bean.somevalue}" required="true" >
<f:selectItem escape="false" escapeItem="false" itemLabel="One <a href="http://google.com" >Google </a>" itemValue="O" />
<f:selectItem escape="false" escapeItem="false" itemLabel="Two <a href="http://stackoverflow.com" >Stackoverflow</a>" itemValue="T" />
</h:selectOneRadio>
Run Code Online (Sandbox Code Playgroud)
我想要的东西如下图所示

Bal*_*usC 16
这是JSF中的纪录片错误.在实际的属性命名itemEscaped,而不是escapeItem(在VDL错误记录)或escape(其中Eclipse的自动完成功能确实autosuggests一些未知的原因,但实际上是完全不存在的VDL).
以下构造应该适合您(至少,它对我来说在Mojarra 2.1.17上):
<h:selectOneRadio>
<f:selectItem itemEscaped="false" itemLabel="One <a href="http://google.com" >Google </a>" itemValue="O" />
<f:selectItem itemEscaped="false" itemLabel="Two <a href="http://stackoverflow.com" >Stackoverflow</a>" itemValue="T" />
</h:selectOneRadio>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11090 次 |
| 最近记录: |