I have the following Enum
:
@AllArgsConstructor
public enum Lojas {
ALIEXPRESS("AliExpress"), MERCADO_LIVRE("Mercado Livre"), EBAY("Ebay"), WISH("Wish"), GEARBEST("Gearbest"), BANGOOD(
"Banggood");
@Getter
@Setter
private String nome;
}
I have this method that lists Enums:
public Collection<String> obterLojas() {
Collection<Lojas> lojas = Arrays.asList(Lojas.values());
Collection<String> nomeLojas = new ArrayList<String>();
for (Lojas loja : lojas) {
nomeLojas.add(loja.getNome());
}
return nomeLojas;
}
My screen that calls this method is the code:
<p:selectOneMenu id="loja" value="#{encomendaController.encomenda.loja}" required="true">
<f:selectItem itemLabel="" itemValue="" />
<f:selectItems value="#{enumHelper.obterLojas()}" var="bean" itemLabel="#{bean}" itemValue="#{bean}" />
</p:selectOneMenu>
My store attribute looks like this:
private String loja;
When I click on the selectOneMenu
I can list the stores normally, after selecting and submitting my form, the value goes to null, does anyone know how I can solve?