女巫是不需要的,jsf-2,selectoneradio"/>

首页 > 解决方案 > h:selectItems itemLabel 逃脱女巫是不需要的

问题描述

我无法逃脱 selectItems itemLabel 以生成图像

例子:

<h:selectOneRadio layout="pageDirection" styleClass="labelWhite" id="logoRadios" value="#{bean.value}" >
	<f:selectItems itemLabelEscaped="false" value="#{imageSources}" var="imgSrc" itemLabel="#{imgSrc}" itemValue="O" />
</h:selectOneRadio>

爪哇:

@Factory("imageSources")

List<SelectItem> imageSourceList= null;

List<Object> allLogos = someService.serviceImplGetAll(var);

imageSourceList= new ArrayList<SelectItem>(allLogos.size());

for(Object value : allLogos)
{

      selectableLogos.add(new SelectItem("<img src=\""+  value.getLogoResource() + "\" /> "));

}

return imageSourceList;

生成时我得到的是:

<td>
<input type="radio" name="j_id579:logoRadios" id="j_id579:logoRadios:0" value="<img src=&quot;/img/rfcLogos/fall_1.svg&quot; /> ">
<label for="j_id579:logoRadios:0"> &lt;img src="/img/rfcLogos/fall_1.svg" /&gt; </label>
</td>

我认为这个值是错误的,但现在我更关心它没有呈现 img src 的部分(不仅仅是图片文本)

标签: jsf-2selectoneradio

解决方案


推荐阅读