4 Replies Latest reply: Nov 1, 2013 11:35 AM by inaser RSS

    invoking bound method with argument problem


      jdev version

      Hello, i'm having issues invoking a method binded here:


      <af:selectOneChoice label="Origem" id="soc1" value="#{bindings.DestacamentoDto.inputValue}">  
                          <af:forEach items="#{bindings.listDestacamentosOrigem.iteratorBinding.allRowsInRange}" var="origem">  
                             <!--  <af:selectItem value="#{origem.idDestacamento}" label="#{origem.codDestacamento}" id="si111"/>  -->


      It calls my method:


      listDestacamentosOrigem(MesaDto mesa) { ... }


      I'm trying to invoke it on a method that opens the popup (wich is the selectOneChoice):


          public String novoTrem() {
              BindingContext bcx = BindingContext.getCurrent();
              DCBindingContainer bc = (DCBindingContainer)bcx.getCurrentBindingsEntry();
              OperationBinding opb = (OperationBinding)bc.getOperationBinding("listDestacamentosOrigem");
              // someMethod is with signature public void someMethod(String someArg)
              MesaUsuarioAppMB mesaUsuarioBean = BeanUtil.getManagedBeanValue("MesaUsuarioAppMB");
              UsuarioSessionMB usuarioBean = BeanUtil.getManagedBeanValue("UsuarioSessionMB");
              MesaDto mesaEmUso = mesaUsuarioBean.getMesaPorUsuario(usuarioBean.getUsuarioDto());
              opb.getParamsMap().put("mesa", mesaEmUso);
              RichPopup popup = this.getPopupTrem();
              RichPopup.PopupHints hints = new RichPopup.PopupHints();
              return null;


      I can see the method on debugging the OperationBinding opb, put the params, but it doesn't invoke the method, i got an error when calling the JSFF:


      Caused By: java.lang.Exception: Failed to invoke method: com.all.cs.domain.execucao.services.impl.execucaoService_s3qz1c_ExecucaoServiceImpl.listDestacamentosOrigem


      Should I put the param in other way? wich one?




        • 1. Re: invoking bound method with argument problem

          instead of



          try with:


          • 2. Re: invoking bound method with argument problem

            Hi, thanks for the answer


            opb.execut(); not working too, still dont enter the method


            I made some tests, and:

            <NamedData NDName="mesa" NDValue="#{TremExecucaoMB.teste}" NDType="domain.planejamento.dto.MesaDto" NDOption="1"/>

            on pageDef works if I put a param in the value, but I dont have this parameter anywhere, and it doesn't work with NDValue pointing to a method..


            Still w/o solution on how to invoke bound method with parameters

            • 3. Re: invoking bound method with argument problem

              Put some "debug" statements (at least System.out.println()) somewhere, to see how statements executes.

              And, after the statement:



              check to see if there errors, ie:

              if (!opb.getErrors().isEmpty()) {

              System.err.println("There are errors !");


              • 4. Re: invoking bound method with argument problem

                Couldn't get it to work, managed to change the way to populate my SelectOneChoice:



                private List<SelectItem> listOrigem;
                    public List<SelectItem> recuperarListaDestacamentosOrigem(MesaDto mesa) {
                        return ADFUtils.parseSelectItem(service.listDestacamentosOrigem(mesa), "getId", "getValue");
                     //(service.listDestacamentosOrigem(mesa) is the method where i find the information and return List
                //somewhere in other method:
                this.listOrigem = recuperarListaDestacamentosOrigem(mesaEmUso);




                    public static List<SelectItem> parseSelectItem(List listaObject, String metodoValue, String metodoLabel) {
                        if (listaObject != null) {
                            return parseSelectItem(listaObject.toArray(), metodoValue, metodoLabel);
                        } else {
                            return Collections.emptyList();
                     public static List<SelectItem> parseSelectItem(Object[] array, String metodoValue, String metodoLabel) {
                         List<SelectItem> listSelectItem = new ArrayList<SelectItem>();
                         for (Object item : array) {
                             Class cls = item.getClass();
                             Method methodValue;
                             try {
                                 methodValue = cls.getMethod(metodoValue, null);
                                 Object value = methodValue.invoke(item, null);
                                 methodValue = cls.getMethod(metodoLabel, null);
                                 Object label = methodValue.invoke(item, null);
                                 SelectItem i = new SelectItem(value,(String)label);
                             } catch (NoSuchMethodException e) {
                             } catch (IllegalAccessException e) {
                             } catch (InvocationTargetException e) {
                         return listSelectItem;



                <af:selectOneChoice label="Origem" id="soc1" autoSubmit="true">
                                     <f:selectItems value="#{requestScope.TremExecucaoMB.listOrigem}" id="si7"/>


                now It's working, populate the SelectOneChoice w/o binding

                maybe this can be usefull for someone w/ the same problem as me


                thanks Cvele for showing up on my topic :]