I have a HashMap in the backing bean and I want to dynamically render multiple select box. Here is the code:
<h:selectManyCheckbox
id="id"
value="#{backingBean.value}"
layout="pageDirection"
styleClass="label"
required="true"
requiredMessage="You must select at least...">
<a4j:repeat var="aGroup" items="#{backingBean.map}">
<f:selectItem id="role#{aGroup.value.property1}" itemLabel="#{aGroup.value.property1}" itemValue="#{aGroup.value.property2}" />
<rich:tooltip for="role" value="#{aGroup.value.property5}" />
</a4j:repeat>
</h:selectManyCheckbox>
It is not rendering.
Using the f:selectItems tag, it is rendering, but I need to manually create the f:selecteItem as I have to attach a rich:tooltip with each f:selectItem.
Any ideas ?
Ravi
Use
<c:forEach>instead of<a4j:repeat>.First add this namespace at the top of your page.
Now replace
<a4j:repeat.....with this.EDIT:
I don’t think that
<rich:toolTip>can be applied to<f:selectItem>. As a weird hack you can do something like this.This is your
managed-beanwhich returns thelistor amap. Here I’m using a map because it seems you are using a map.Now your
xhtmlcode would be like this. Here I’m renderingselectItems dynamically. However this is not necessary for this to work.That is it…
Note the
<rich:toolTip>which is set asrendered="false". This is required. Otherwise some importantJSparts are not imported and yourtoolTipwill not work.