selectOneMenu primefaces does not send value to bean

Asked

Viewed 66 times

0

Hello Staff I want to request a help in the first faces combobox feature, in which I rode as below but does not work, tested in various ways based on the net foruns using for example valueChangeListener (https://stackoverflow.com/questions/9848203/jsf-fajax-listener-not-called?rq=1) and it didn’t work.

My xhtml

value="#{ msg['configuracao.mensagem.opcoes'] } "
for="idOpcoes" />
<p:selectOneMenu id="idOpcoes"
    value="#{teste}">
    <f:selectItem itemLabel="#{ msg['selecione.um'] }" 
                      noSelectionOption="true" />
    <f:selectItem itemLabel="Opcao 1" itemValue="1" />
    <f:selectItem itemLabel="Opcao 2" itemValue="2" />
    <p:ajax update=":formPrincipal:grid" 
        listener="#{meuBBean.changePanel}" />
</p:selectOneMenu>

My Bean // var to get Selectitem value @Getter @Setter private object value = "";

public void changePanel(AjaxBehaviorEvent event) {

            // Testando para ver qual valor chega pelo event
    System.out.println("\n\n\n Valor q chegou event" +event.getSource());

            // Testando para ver qual valor chega pela var value
    System.out.println("\n\n\n Valor q chegou String" +value.toString() );

    if (event.getSource().equals("1")) {
        habilitaPanelGrig = true;
    }
    else if (event.getSource().equals("2"))
        habilitaPanelGrig = false;
    }
}

And this returns

Value q arrived String [04/11/19 23:25:22:041 BRST] 0000012e Systemout O [04/11/19 23:25:24:645 BRST] 0000012c Systemout O

Valor q chegou eventorg.primefaces.Component.selectonemenu.Selectonemenu@a 42092ff [04/11/19 23:25:24:645 BRST] 0000012c Systemout O

Thanks in advance.

1 answer

0

I managed to resolve here, the question was the value declared in the value of selectOneMenu in my case name "test" that I had not stated in the Bean:

Correction

-- myBean @Getters @Setters private string test;

value="#{ msg['configuration.message.options'] } " for="idOptions" />

Browser other questions tagged

You are not signed in. Login or sign up in order to post.