I want to dynamically create a SelectOnListBox in JSF (Primefaces), but I don't know how to fill in the values with "Verde" and "Azul"
FacesContext fCtx = FacesContext.getCurrentInstance();
ELContext elCtx = fCtx.getELContext();
ExpressionFactory ef = fCtx.getApplication().getExpressionFactory();
getL_valores().put("Verde", "Verde");
getL_valores().put("Azul", "Azul");
javax.faces.component.html.HtmlSelectOneListbox lista = new javax.faces.component.html.HtmlSelectOneListbox();
lista.setRendererType("javax.faces.Listbox");
lista.setId("variacion1");
lista.setValue(getL_valores());
lista.setLabel("lista1");
dynamicFieldGroup = new HtmlPanelGrid();
dynamicFieldGroup.setColumns(4);
dynamicFieldGroup.getChildren().add(lista);
This is my xhtml
<h:form id="Form1">
<p:panelGrid columns="2" binding="#{b_detalle_productos.dynamicFieldGroup}"></p:panelGrid>
</h:form>