h:selectItems itemLabel escapes <img src> witch is unwanted

228 views Asked by At

I can't escape selectItems itemLabel to generate an image

Example:

<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;

All I get when generated is:

<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>

The value is wrong I reckon but for now I'm more concerned on the part that it did not render the img src(not picture only text)

0

There are 0 answers