9 Replies Latest reply on Apr 26, 2011 7:46 AM by Ilya Shaikovsky

    a4j:commandLink problem

    geschtli Newbie

      I think i have found the problem, why the 'commandLink' does not work

      for me and others.

       

      If someone use this tag without includes it works fine, how the examples

      from the community does, but set it in 2 includes, how it some users does,

      then his funtion is broken.

       

      Eg.

      make a

       

      <ui:define name="content">

            <ui:include src="/content/work.xhtml"/>

      </ui:define>

       

      and then call in work.xhtml an include with

       

      <ui:define name="content">

                  <ui:include src="/content/mytable.xhtml"/>

      </ui:define>

       

      , then commandLink works in mytable.xhtml not more.

      Setting values in backing beans, also have no effect anymore.

       

      Sadly i have not the sources from commandLink, so i can't

      rewrite it for me.

      So i think, i must change all my layout, why use '<a4j:commandLink ...'

      is essential to me, to make changes in the table.

      Or is there an alternative??

        • 1. a4j:commandLink problem
          Nick Belaevski Master

          Hi,

           

          It should work. What is your problem: ajax request not sent, error on server or on the client, smth. else?

          • 2. a4j:commandLink problem
            geschtli Newbie

            Hello Nick

             

            What you say. Request not send. Backing bean not filled.

            Test itself. But not a simple side. Do it in 2 includes, and you can see

            the effect.Nothing.You would no see something in the log.

             

            Do a logger in your beans and you got no response in there.

            (Test it with Jboss 6 and Myfaces.)

            • 3. a4j:commandLink problem
              Ilya Shaikovsky Master

              you sure that having complex templates wth includes not added nested forms by accident? It's not allowed in JSF.

              • 4. a4j:commandLink problem
                Nick Belaevski Master

                Ok, if request is not send, then it should be client-side problem. Do you have JS errors in browser? Have you properly declared necessary h:head/h:body/h:form tags?

                • 5. Re: a4j:commandLink problem
                  geschtli Newbie

                  Hello Ilya, Nick

                   

                  Yes i have very complex templates with some nested forms in it. In some children i

                  must do a do double click to change the parameters from the backing beans.

                  That was the same problems how my former problems with

                  the sort-order in tables.

                   

                  Now, i have no other solution found, to make parts (header, navigation, left area, content area, right area and footer)

                  from my side, so i can make partiell (ajax like) changes in the areas.

                  (E.g. A link (mouse click event) in the navigation-area, should only make a change in the content-area.)

                   

                  I think, what i search for is, a java 'GridBagLayout'  or 'BorderLayout' in richfaces, to do this job.

                  Is there such component already available?

                  • 6. Re: a4j:commandLink problem
                    geschtli Newbie

                    At last now i have found a solution for my problems.

                     

                    Sorry, but it seems that the richfaces 4 have a little bug in its commandLink component.

                     

                    I simple changed all my commandLink calls from

                    <a4j:commandLink to <h:commandLink and all works correct

                     

                    <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                        xmlns:h="http://java.sun.com/jsf/html"

                        xmlns:f="http://java.sun.com/jsf/core"

                        xmlns:ui="http://java.sun.com/jsf/facelets"

                        xmlns:a4j="http://richfaces.org/a4j"

                        xmlns:rich="http://richfaces.org/rich">

                     

                    it seems that something counts all <a4j:commandLink 's after each redering,

                    and the count is than the click-count for the next <a4j:commandLink..

                     

                    e.g.

                                                 rendering                             rendering                

                    <a4j:commandLink    ->     <a4j:commandlink        ->          <a4j:commandLink ->.....

                        needs one click                  needs two clicks                      needs three clicks

                     

                    the richfaces user  normally awaits a click per <a4j:commandLink - command,

                    and thinks in that moment, it's program doesn't work.

                    But a double or threetime click does reveal that the program work's.

                     

                    Your database test program work's perfect, also the commands '<a4j:param' and '<f:setPropertyActionListener' .

                    Problem is, to jump into your demo over a '<a4j:commandLink', then

                    you must double click to fire an event.

                    • 7. Re: a4j:commandLink problem
                      Ilya Shaikovsky Master

                      http://community.jboss.org/message/601332#601332 I guess that's really JSF issue from that thread.

                      • 8. Re: a4j:commandLink problem
                        geschtli Newbie

                        Hi Ilya

                         

                        I don't know.

                        I jump with a <h:commandLink into my program-part and

                        use than <a4j:commandLink and it works all correct.

                         

                        But now, i have found another nasty little problem.

                         

                        Setting a value direct in a page, e.g. #{myBean.setRenderSide('mySide')} ,

                        does destroy all funktionallity from a <f:setPropertyActionListener target="..." value="..." />

                        and <a4j:param value="..." assignedTo="...." />

                        A setting in a backing bean is than imposssible.

                         

                        Now i have the problem, to set a value in a backing bean, without

                        i must trigger an event.

                        • 9. a4j:commandLink problem
                          Ilya Shaikovsky Master

                          any exception in server log or console?