Why isn’t jsf recognizing Istener in the Bean?

Asked

Viewed 237 times

1

Why jsf is not recognizing the Bean Reader?

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 System, 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>

When 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 the method does not exist in Bean.

  • He even tried without the ()? When you use actionListener="#{atividadeController.mudarSolicitante()}" means explicitly a method without parameters. Since you need the event, then recommend to declare method Expression only by name actionListener="#{atividadeController.mudarSolicitante}".

  • Instead of "<a4j:support " he has tried to use "<p:ajax" ?

  • I made the change by withdrawing the () but the error remains.....

  • `org.apache.jasper.el.JspMethodNotFoundException: /atividade/formAtividade.jsp(171,18) '#{atividadeController.mudarSolicitante}' Method not found: com.porto.npf.sgpsweb.controller.AtividadeController@3f515f14.mudarSolicitante(javax.faces.event.ActionEvent)'

  • Jose am using jsf 1.2 richfaces 3.3.3 (Client restriction)

2 answers

0

Save young, also work with this suffering of JSF 1.2, when I need to do some event with a selectOneMenu, do an onchange="Submit()" in the component itself, follows example:

<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 in the system with a4j, instead of using ValueChangeEvent uses the ActionEvent, following 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>

0

the a4j:support tag does not have a valueChangeListener attribute? If it does, it is the one you should use.

  • I tried, but it didn’t happen either.

Browser other questions tagged

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