I have this code
<select id="vlm" name="vlm" class="pnx-inline-edit-select">
<option value="#{agreement.valueForNiVlmVersion}">
<h:outputText value="#{agreement.valueForNiVlmVersion}"/>
</option>
</select>
This displays a dropdown box with the content of valueForNiVlmVersion. Now, in that same bean, I have a list of values called validValues that needs to be displayed there instead of a single valueForNiVlmVersion. So, I need to remove the valueForNiVlmVersion and instead, add the values from validValues. The thing is that I'm not sure how to iterate through a list to pull the values dynamically. I can use javascript and jquery 1.9.
Thanks!
You can use an iterative component for this purpose like <ui:repeat>
, to produce custom HTML code in a way you like:
<select id="vlm" name="vlm" class="pnx-inline-edit-select">
<ui:repeat value="#{bean.validValues}" var="val">
<option value="#{val.value}">#{val.label}</option>
</ui:repeat>
</select>
But ultimately, why are you not considering a standard <h:selectOneMenu>
solution?