6 Replies Latest reply on Jan 30, 2011 4:50 PM by nbelaevski

    RichFaces 4 - Call action from a4j:Ajax

    jerarckill

      Hello everybody,

       

      In RichFaces 3, it was possible, through the use of the "action" attribute of the <a4j:support>, to call a backing bean action ("MethodBinding pointing at the application action to be invoked") to execute when the ajax call was performed.

       

      This allowed implementing many stuff that required some events to happen on the GUI.  Is it still possible to do this with the a4j:ajax tag?

       

      As an example, I would like to develop something like a MultiSelect ComboBox where, each time I click on an element, it appears on a table to the right, clearly showing what has been selected so far.  The table would need to know when an element is selected from the ComboBox and be updated accordantly.  For this, I need to be able to notify the table of the update.  Is it understandable?

       

      May I also ask you where you get your information from?  I mean, I am trying to find the lists of attributes that each RichFaces 4 component accepts but I can't find them (the RichFaces 4 component Gallery does not list this as the one for RichFaces 3 did).

       

      Thank you very much in advance for your help!

       

      Jérôme Jadoulle

        • 1. RichFaces 4 - Call action from a4j:Ajax
          ilya40umov

          1) You can look for components' attributes in taglib files. You can find rich.taglib.xml and a4j.taglib.xml here:

          richfaces-components-ui-4.0.0.XXXXXXX.jar!/META-INF/rich.taglib.xml

          richfaces-components-ui-4.0.0.XXXXXXX.jar!/META-INF/a4j.taglib.xml

          2) You can look at showcase application where some of attributes are already used in examples.

          • 2. Re: RichFaces 4 - Call action from a4j:Ajax
            jerarckill

            Hello and thanks Ilya!

            Here below a list of the attributes of the f:ajax tag:

             

                    <attribute>

                        <name>bypassUpdates</name>

                        <type>boolean</type>

                    </attribute>

                    <attribute>

                        <name>data</name>

                        <type>java.lang.Object</type>

                    </attribute>

                    <attribute>

                        <name>disabled</name>

                        <type>boolean</type>

                    </attribute>

                    <attribute>

                        <name>execute</name>

                        <type>java.util.Collection</type>

                    </attribute>

                    <attribute>

                        <name>immediate</name>

                        <type>boolean</type>

                    </attribute>

                    <attribute>

                        <name>limitRender</name>

                        <type>boolean</type>

                    </attribute>

                    <attribute>

                        <name>listener</name>

                        <type>javax.el.MethodExpression</type>

                    </attribute>

                    <attribute>

                        <name>onbeforedomupdate</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onbegin</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oncomplete</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onerror</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>queueId</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>render</name>

                        <type>java.util.Collection</type>

                    </attribute>

                    <attribute>

                        <name>status</name>

                        <type>java.lang.String</type>

                    </attribute>

             

            I suppose the "listener attribute is the one I am searching for.

            Testing...

            • 3. Re: RichFaces 4 - Call action from a4j:Ajax
              jerarckill

              Ok, I tested and indeed, the listener attribute does just that!

               

              Silly example I made:

              <a4j:ajax event="click" execute="@this" render="workflowDefinitionSpecific, @this" listener="#{multiCriteriaSearchBean.callMe}"/>

               

              callMe being just a simple void method in the bean Named multiCriteriaSearchBean.

               

              Thank you for your help Ilya!

              • 4. RichFaces 4 - Call action from a4j:Ajax
                ilya_shaikovsky

                B.t.w. if your intention is to process some parent component events - action or value changing - define corresponding listeners at parent component instead. Them will be called for ajax requests and provide component original events with proper information. I prefert that as it more accurate.

                • 5. Re: RichFaces 4 - Call action from a4j:Ajax
                  jattra

                  Hello,

                  I am using RF4 integrated with Spring Webflow. I would like to have a4j:ajax to invoke Webflow transition. In RF3 it was possible using <a4j:support action="myTransition" />

                   

                  I see I can use the new listener attribute to change things but it is not an elegant way in my case when using webflow. Can anybody help me, please? Thank You in advance.

                  • 6. Re: RichFaces 4 - Call action from a4j:Ajax
                    nbelaevski

                    Hi,

                     

                    You can try sending ActionEvent from Ajax behavior listener or calling NavigationHandler directly.