1 Reply Latest reply on Mar 20, 2008 11:57 AM by Ben Maisano

    A4j:support actionExpression not calling server

    Ben Maisano Newbie

      I'm trying to add Ajax4jsf to an existing JSF application, where it did not exist anywhere before. I've read the tutorial and already done the following:
      Downloaded the Ajax4jsf-1.1.1 jar and put it in my WEB-INF/lib directory.
      Added the following to my web.xml file:
      <!-- Added for Ajax4jsf -->
      <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>server</param-value>
      </context-param>

      <display-name>Ajax4jsf Filter</display-name>
      <filter-name>ajax4jsf</filter-name>
      <filter-class>org.ajax4jsf.Filter</filter-class>

      <filter-mapping>
      <filter-name>ajax4jsf</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      REQUEST
      FORWARD
      INCLUDE
      </filter-mapping>

      <listener-class>
      com.sun.faces.config.ConfigureListener
      </listener-class>


      **I think only the filter part is actually necessary to be added, but I wasn't positive. I then added the tag lib import to one of my existing jsf pages:
      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>

      I next tried to add an ajax support tag to an existing selectOnePullDown

      <h:selectOneMenu styleClass="employeeStyle" id="employeeList" tabindex="1" value="#{EmployeeMB.individualId}">
      <f:selectItem itemValue="" itemLabel="" />
      <f:selectItems value="#{CaseMB.employeeList}" />
      <a4j:support event="onchange" onsubmit="alert('a4j called');"
      actionExpression="#{ConditionAction.retriveMemberInfo}" reRender="memberList" />
      </h:selectOneMenu>

      As you can see above, I've added the a4j:support tag and the actionExpression should call the retriveMemberInfo method on the ConditionAction Managed bean ( which is setup in the faces-config.xml ). I added a sanity check in the onsubmit attribute, and that pop up alert does come up. However, my problem is the server managed bean method never gets called, and I done see my memberList component reRendered. The memberList is another selectOneMenu item. I put a braek point in the retriveMemberInfo, but still see nothing getting called, and no error logs from console. I do see this message when my app starts up in console output:
      com.ibm.ws.jsf.configuration.FacesConfigParser parseShared FacesConfigParser.parseShared(): unable to locate : [facet-name]
      com.ibm.ws.jsf.configuration.FacesConfigParser parseShared FacesConfigParser.parseShared(): unable to locate : [facet]

      Googling for this msg I didn't find much, only something about two faces-config.xml files and a class loader parent last thing. I did notice the Ajax4jsf.jar has a faces-config.xml file referenced in its META-INF/ path. Any help with this is greatly appreciated, thanks.

        • 1. Re: A4j:support actionExpression not calling server
          Ben Maisano Newbie

          As a follow up, I converted the selectOneMenu from a valueChangeEvent as it was this:
          valueChangeListener="#{ConditionAction.retriveMemberInfo}"

          The method takes a "ValueChangeEvent" which I think may be the problem. What attributes for an a4j:support tag should I use that work with a ValueChangeEvent in faces. I see the actionListener event attribute mentioned in the JBos devGuide chapter 6, which says it takes an ActionEvent. Is there a way to do this in Ajas4jsf ?