5 Replies Latest reply on Sep 18, 2007 11:56 AM by Fab Mars

    a4j:commandLink actionListener not working

    Vidur Dhanda Newbie

      Hello,

      I just upgraded from ajax4jsf 1.1.1 and richfaces 3.0.1 to richfaces 3.1.0. It seems that in 3.1.0 the a4j:commandLink actionListener is not being called whereas it was being called correctly in the previous configuration.

      I'm using facelets and JSF RI. Some code example:
      In a ui:composition:
      <a4j:commandLink
      id="#{eventName}Edit"
      value="Edit"
      immediate="true"
      ajaxSingle="true"
      actionListener="#{creditEventDialog[editMethod]}"
      reRender="creditEventDialogContentInclude"
      limitToList="true"
      status="ajaxStatus"
      oncomplete="javascript:Richfaces.showModalPanel('creditEventDialog')"
      rendered="#{dataRecord[eventName]}">
      </a4j:commandLink>


      Which is being ui:include'd and passed ui:params to define eventName, editMethod, etc. Note: This works fine before richfaces 3.1.

      Is this a bug?

      Regards,
      Vidur

        • 1. Re: a4j:commandLink actionListener not working
          Nick Belaevski Master

          Vidur,

          could you please provide full page code?

          • 2. Re: a4j:commandLink actionListener not working
            rpa_rio Novice

            In my case a simple action isn't called.

            • 4. Re: a4j:commandLink actionListener not working
              Fab Mars Novice

              More details for my case: I tested that with JSF 1.1 & 1.2.

              1) Use some basic action binding. This one is used in my app to hide some parts of the page.

              <a4j:commandButton id="boxFoldUp" image="/images/box-close.png" rendered="#{!layout.foldedAll}" actionListener="#{layout.hideAllPanes}" ajaxSingle="true" reRender="topPane, topFoldUp, topFoldDown, leftPane, leftFoldLeft, leftFoldRight, rightPane, rightFoldRight, rightFoldleft, taskPane, tasksFoldUp, tasksFoldDown" />


              This worked in RF 3.0.2, but to make it to work on 3.1.0 you have to use
              actionListener="#{layout[hideAllPanes]}"
              which would have failed in 3.0.2, as hideAllPanes is actually bound to nothing, it's a String !!! It would have worked with quotes, like
              actionListener="#{layout['hideAllPanes']}"




              2) Use some composition/templating. I defined a custom tag for some menu link called "xx:treeLinkAction".
              <ui:composition>
               <a4j:commandLink ajaxSingle="true" action="#{backingBean[action]}" styleClass="text-decoration: none;" rendered="#{rendered and action != null}">
               <h:panelGrid columns="2" columnClasses="alignMiddle">
               <h:graphicImage value="#{image}" style="border: 0px;"/>
               <h:outputText value="#{label}" style="color: black;"/>
               </h:panelGrid>
               </a4j:commandLink>
              </ui:composition>
              


              If I use it in my page:
              <xx:treeLinkAction backingBean="#{mainHandler}" action="startNewThing" label="New Thing" image="/images/newthing.gif" rendered="true"/>

              Then I get an error stacktrace whose cause is
              WARN: Error Rendering View[/pages/newThing.xhtml]
              javax.el.ELException: /WEB-INF/facelet/treeLinkAction.xhtml: Property 'startNewThing' is not found on type: com.company.pack.subpack.MainHandler

              Clearly the method binding fails again here and there is no workaround I can find.


              • 5. Re: a4j:commandLink actionListener not working
                Fab Mars Novice

                And all of a sudden it works now...go figure.