4 Replies Latest reply on Jun 29, 2015 9:20 AM by Vinay T

    a4j:commandLink clicked and framework not invoking saveState?

    Vinay T Newbie



      I am working on migrating a project from myfaces 2.1.17 to 2.2.8 with spring 3.2.11 for DI and deployed on tomcat 7 and JDK 1.6.

      I have a "composite component" connected to a "backing component" called operationViewer. The code is below. Its not complete to keep it short. I know that the backing component has a request scope and hence it has a overridden saveState method in which the required state is saved


      <composite:interface componentType="operationViewer">

          <composite:attribute name="value" required="true"/>       




         <h:panelGroup rendered="#{cc.mainRendered}" binding="#{cc.filterPanelComponent}">

          <a4j:outputPanel id="filterPanel"  ajaxRendered="true">

              <h:panelGroup rendered="#{cc.filterRendered}">

      ......     more code here.




              <h:panelGroup rendered="#{not cc.filterRendered}">

                  <fieldset class="noBorder">


                          <a4j:commandLink action="#{cc.onFilterToggle}" render="filterPanel" styleClass="filterToggle">

                              <h:graphicImage url="#{pageContext.request.contextPath}/images/expand.gif"

                                  styleClass="expandCollapseImg" />








      ..... a lot more code here.


      The java class:

      public class UIOperationViewer extends UIComponentBase implements NamingContainer


          private boolean filterRendered; - also has getters and setters.


          public void onFilterToggle()






          public Object saveState(final FacesContext context)


              return new Object[] {super.saveState(context), isFilterRendered(), table, searchCriteria, eventViewerDelegate,

                  isStatsRendered(), isLogRendered() };



      public void restoreState(final FacesContext context, final Object state)





      tons of code here




      Now my problem is, whenever i click on this a4j:commandLink, the action method "onFilterToggle()" gets called, but the framework never calls the saveState. Because of this and the backing component being request scoped, the value of FilterRendered is always false. This was not the case when the same code is used with myfaces 2.1.17!

      I was just wondering if there is a bug in Myfaces or Richfaces?


      Is this the intended behavior of JSF 2.2? If yes, how do I solve it?

      UPDATE: I replaced a4j:commandLink with h:commandLink and in this case saveState is called. But I want the Ajax behavior!




      Message was edited by: Vinay T