Why is jsf not recognizing listener in Bean?

1

Why is jsf not recognizing the Bean listener?

My bean:

/**
 * Listener que escuta a mudança do tipo de Solicitante
 * 
 * @param event
 */
public void mudarSolicitante(ValueChangeEvent event){
    logger.info("Novo objeto : " + event.getNewValue());
    solicitanteId = (Integer) event.getNewValue();
}

I call this selectOneMenu listener, as below:

<h:column>
<h:selectOneMenu
    value="#{atividadeController.solicitanteId }"
    id="solicitante">
    <f:selectItems 
         value="#{atividadeController.listaSelectSolicitantesAtivos}" />
    <a4j:support event="onchange" 
          actionListener="#{atividadeController.mudarSolicitante()}"
          ajaxSingle="true" immediate="true"></a4j:support>
</h:selectOneMenu>

Running the following exception is displayed:

javax.faces.event.AbortProcessingException: /atividade/formAtividade.jsp(171,18) '#{atividadeController.mudarSolicitante()}' Method not found: com.porto.npf.sgpsweb.controller.AtividadeController@75b3883f.mudarSolicitante()
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:118)

That is, it is returning that method does not exist in the Bean.

    
asked by anonymous 22.09.2015 / 02:51

2 answers

0

Does not the a4j: support tag have a valueChangeListener attribute? If so, it's the one you should use.

    
11.11.2015 / 02:46
0

<h:selectOneMenu styleClass="PaginaList" id="acordoListBox" value="#{pc_DadosPreEmpenhoPageForm.dadosPreEmpenhoDTO.acordo}" onchange="submit();" disabled="#{pc_DadosPreEmpenhoPageForm.tipoPreEmpenho eq 'Reserva'}">
    <f:selectItems value="#{pc_DadosPreEmpenhoPageForm.acordos}" />
</h:selectOneMenu>

I have an example here on the system with a4j, instead of using ValueChangeEvent use ActionEvent , follow example:

public void alterarRecursoDoBID(ActionEvent event) {
        if (p.getModalidade().toUpperCase().contains("BID")) {
            p.setRecursoBID(true);
        } else {
            p.setRecursoBID(false);
        }
    }

Page:

<h:selectOneMenu styleClass="PaginaList" id="modalidadeListBox" disabled="#{pc_MeuBeanPageForm.processoRecebidoRender == true?false:true}" value="#{pc_MeuBeanPageForm.MeuBean.modalidade}" >
    <a4j:support event="onchange" ajaxSingle="true" actionListener="#{pc_MeuBeanPageForm.alterarRecursoDoBID}" reRender="recursoBIDRadio"/>
    <f:selectItems value="#{pc_MeuBeanPageForm.modalidadeItens}" />
        <f:selectItem id="modalidadeInativo" itemValue="#{pc_MeuBeanPageForm.MeuBean.modalidade}" itemLabel="#{pc_MeuBeanPageForm.processoLicitatorio.modalidade}" />
</h:selectOneMenu>
    
27.09.2018 / 20:12