1 2 Previous Next 18 Replies Latest reply on May 22, 2009 9:23 AM by kusakd

    commandLink / actionparam problem in 3.3.0

    zeltner

      Hi
      I have a problem with the following code:

      <a4j:commandLink value="Save" actionListener="#{TestBean.action}">
       <a4j:actionparam name="p1" value="2" assignTo="#{TestBean.param}"/>
      </a4j:commandLink>
      

      In RF 3.2.2 the parameter was assigned before the listener was invoked. In RF 3.3.0.CR2 the parameter is assigned after the invocation of the listener.

      Thanks.

      /Markus

        • 1. Re: commandLink / actionparam problem in 3.3.0

          Do you have the same jsf impl when you test 3.2.2 and 3.3 ?

          • 2. Re: commandLink / actionparam problem in 3.3.0
            zeltner

            yes, Sun JSF 1.2, Facelets 1.1.12 running on JBoss 4.2. Only the RF jars are exchanged.

            • 3. Re: commandLink / actionparam problem in 3.3.0
              ilya_shaikovsky
              • 4. Re: commandLink / actionparam problem in 3.3.0
                darkmarine

                Sorry but i did not understand how to solve the problem using RichFaces >3.3

                I have the following code, that works with RichFaces 3.2:

                <a4j:commandLink actionListener="#{bean.doAction}">
                <f:setPropertyActionListener target="#{bean.property}" value="test" />
                </a4j:commandLink>
                

                The problem is the same, as described by zeltner.

                How should this be solved?
                I have read RF-5606 but i did not find a solution.

                (I am using MyFaces 1.2.6 / Tomahawk 1.1.8 / Facelets 1.1.14)



                • 5. Re: commandLink / actionparam problem in 3.3.0
                  ilya_shaikovsky

                  you could use actionparam instead of f:set* component and its actionListener attribute.

                  • 6. Re: commandLink / actionparam problem in 3.3.0
                    darkmarine

                    I tried to replace all my f:setPropertyActionListener with a4j:actionparam and it works in nearly all cases.

                    But what should i do if i have the following situation?

                    <a4j:commandLink actionListener="#{testBean.doAction}">
                     <f:setPropertyActionListener target="#{testBean.param}" value="1" />
                     <f:setPropertyActionListener target="#{testBean.param1}" value="2" />
                     <h:outputText value="doAction" />
                    </a4j:commandLink>
                    


                    How can i pass multiple parameters (like in the example above) with the a4j:actionParam, so that both parameters are set BEFORE the actionListener is invoked?

                    Thanks.

                    • 7. Re: commandLink / actionparam problem in 3.3.0
                      darkmarine

                      Can anybody please tell me what was wrong with the old approch?
                      Why are so simple tasks so complicated?

                      • 8. Re: commandLink / actionparam problem in 3.3.0
                        nbelaevski

                         

                        "DarkMarine" wrote:
                        I tried to replace all my f:setPropertyActionListener with a4j:actionparam and it works in nearly all cases.

                        But what should i do if i have the following situation?
                        <a4j:commandLink actionListener="#{testBean.doAction}">
                         <f:setPropertyActionListener target="#{testBean.param}" value="1" />
                         <f:setPropertyActionListener target="#{testBean.param1}" value="2" />
                         <h:outputText value="doAction" />
                        </a4j:commandLink>
                        


                        How can i pass multiple parameters (like in the example above) with the a4j:actionParam, so that both parameters are set BEFORE the actionListener is invoked?

                        Thanks.
                        Add <f:actionListener> just after the second <f:setPropertyActionListener>

                        • 9. Re: commandLink / actionparam problem in 3.3.0
                          nbelaevski

                           

                          "DarkMarine" wrote:
                          Can anybody please tell me what was wrong with the old approch?
                          Why are so simple tasks so complicated?
                          a4j:* command components were updated to comply with JSF 1.2 standard.

                          • 10. Re: commandLink / actionparam problem in 3.3.0
                            julienc

                            I've the same problem ,i just passed 3.2.2 to 3.3.0/3.3.1 and now this code doesn't work

                            <a4j:commandButton image="/img/page_edit.png" actionListener="#{mybean.saveRoute}">
                            <f:setPropertyActionListener value="#{route}" target="#{mybean.routeSelected}" />
                            </a4j:commandButton>
                            


                            How resolve it ?

                            thanks

                            • 11. Re: commandLink / actionparam problem in 3.3.0
                              ilya_shaikovsky

                              and we have the same answer for you as provided already to other guys:) move actionListener definition to actionparam tag.

                              Its specfic to JSF specification. nested listeners called after parent ones. so param assigned after.

                              • 12. Re: commandLink / actionparam problem in 3.3.0
                                julienc

                                yep i have tried with actionparam but i've a problem with it

                                if i put commons-beanutils.jar in web-inf/lib in the war i have no a classnotfounderror on propertyUtils

                                else if i put it on general /Lib
                                i have :

                                Caused by: java.lang.StackOverflowError beanutils
                                at org.ajax4jsf.javascript.ScriptUtils.toScript(ScriptUtils.java:84)
                                at org.ajax4jsf.javascript.ScriptUtils.toScript(ScriptUtils.java:165)
                                


                                .... only if a have attribute on <A4j:Actionparam>

                                • 13. Re: commandLink / actionparam problem in 3.3.0
                                  darkmarine

                                   

                                  "ilya_shaikovsky" wrote:
                                  you could use actionparam instead of f:set* component and its actionListener attribute.


                                  So back again to this issue.

                                  Now i am using a4j:actionparam instead of f:setPropertyActionListener as suggested. But now i have the problem that i need to work with custom objects.

                                  Writing a custom converter for each object cannot be the solution. It has absolute no usability and it is really complicated.

                                  Thanks for any suggestions. :)

                                  • 14. Re: commandLink / actionparam problem in 3.3.0
                                    nbelaevski

                                    Have you tried:

                                    <a4j:commandLink actionListener="#{testBean.doAction}">
                                     <f:setPropertyActionListener target="#{testBean.param}" value="1" />
                                     <f:setPropertyActionListener target="#{testBean.param1}" value="2" />
                                     <a4j:actionparam actionListener="...." />
                                     <h:outputText value="doAction" />
                                    </a4j:commandLink>

                                    ?

                                    1 2 Previous Next