gpt4 book ai didi

jsf - 如何逃避:selectItem itemLabel attribute

转载 作者:行者123 更新时间:2023-12-04 13:20:05 25 4
gpt4 key购买 nike

如何转义f:SelectItem itemLabel属性,以便可以在标签中添加超链接?

使用以下代码,我可以转义h:outputText,但不能转义f:selectItem

            <h:outputText value="MyLink &lt;a href=&quot;http://google.com&quot; &gt;Google &lt;/a&gt;" escape="false"/>              
<h:selectOneRadio id="p" value="#{bean.somevalue}" required="true" >
<f:selectItem escape="false" escapeItem="false" itemLabel="One &lt;a href=&quot;http://google.com&quot; &gt;Google &lt;/a&gt;" itemValue="O" />
<f:selectItem escape="false" escapeItem="false" itemLabel="Two &lt;a href=&quot;http://stackoverflow.com&quot; &gt;Stackoverflow&lt;/a&gt;" itemValue="T" />
</h:selectOneRadio>

我想要以下图片中的内容

最佳答案

这是JSF中的一个记录错误。 actual attribute名为itemEscaped,而不是escapeItem(as incorrectly documented in VDL)或escape(Eclipse自动完成功能确实出于某些未知原因而自动建议使用,但实际上在VDL中完全不存在)。

以下构造应该为您工作(至少在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>

关于jsf - 如何逃避:selectItem itemLabel attribute,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14238646/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com