4 Replies Latest reply on Mar 23, 2009 1:20 PM by nbelaevski

    setPropertyActionListener

    elf

      Hi

      I created HtmlAjaxCommandLink dynamically and tried to pass parameter to action, I used HtmlActionParameter for it, but! it did not work.
      In some cases it works in some not. In this case I used HtmlAjaxCommandLink inside HtmlExtendedDataTable and it did not work.
      I read many messages hear about problems with non-working HtmlActionParameter .
      How can I create dynamically setPropertyActionListener ? I want to try to use it, but I do not know how to create it :(
      Or may be, it is posible to call method with parameter inside, for example "myMethod(String myParam) instead of myMethod()" ?
      Please , help me.
      Thank you in advance.

        • 1. Re: setPropertyActionListener
          elf

          please help me
          How I can dynamically create <f:setPropertyActionListener> and use it ?
          Or <f:attribute> ?
          Please point me to the some manual or code example.

          • 2. Re: setPropertyActionListener
            ilya_shaikovsky

            "In some cases it works in some not. "

            Can't confirm this. show the problematic code.

            • 3. Re: setPropertyActionListener
              elf

              I have a lot of dynamically generated code :( it would be hard to meet ends there.
              When I use HtmlAjaxCommandLink inside form - everything works fine.
              But THE SAME CODE I use inside form, inside HtmlExtendedDataTable (I have one column with HtmlAjaxCommandLink elements) and prameter do not pass to the bean.
              Please point me how I can use <f:setPropertyActionListener> or <f:attribute> dynamically instead of HtmlActionParameter. May be it solve my problem.

              • 4. Re: setPropertyActionListener
                nbelaevski

                 

                ValueExpression target = context.getApplication().getExpressionFactory().createValueExpression(context.getELContext(), "#{ctrl.id}", Long.class);
                
                ValueExpression propertyValue = context.getApplication().getExpressionFactory().createValueExpression(context.getELContext(),"#{row.id}", Long.class);
                
                SetPropertyActionListenerImpl listener = new SetPropertyActionListenerImpl(target,propertyValue);
                a4jSupportComponent.addActionListener(listener);