我无法转义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>
JAVA:
@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="/img/rfcLogos/fall_1.svg" /> ">
<label for="j_id579:logoRadios:0"> <img src="/img/rfcLogos/fall_1.svg" /> </label>
</td>
我认为该值是错误的,但现在我更担心的是它未呈现img src(不是仅显示文字)