如何逃脱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>
我想要如下图所示的东西
这是 JSF 中的一个记录错误。这实际属性 http://grepcode.com/file/repo1.maven.org/maven2/com.sun.faces/jsf-api/2.1.13/javax/faces/component/UISelectItem.java#UISelectItem.setItemEscaped%28boolean%29被命名itemEscaped
, not escapeItem
(VDL 中的记录不正确 http://docs.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/f/selectItem.html) or escape
(Eclipse 自动完成确实会出于某种未知原因自动建议,但实际上 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>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)