0 Replies Latest reply on Sep 11, 2007 8:41 AM by martyburen

    Ajax4JSF ClassCastException with JSF Sun RI 1.2

    martyburen

      Hello everybody.

      I tried to use <a4j:support> with Sun's JSF 1.2 RI components, which are supported according to the documentation. Nevertheless I get a ClassCastException on this:

      <h:commandLink value="test" action="#{anAction}">
       <a4j:support reRender="outputGroup" event="onclick" />
      </h:commandLink>
      


      Yes, I could use <a4j:commandLink> which is working fine, but for some other components, there is no replacement like this (including custom components which also inherit from UIComponentELTag)

      The problem is that 1.2 components extend javax.faces.webapp.UIComponentELTag and not javax.faces.webapp.UIComponentTag anymore.

      The AjaxSupportTag class seems to be aware of this, which can be seen in the following method:

      protected void setParentProperties(UIAjaxSupport uiComponent) {
      
       //Find parent UIComponentTag
       UIComponentTag componentTag = null;
       try {
       componentTag = UIComponentTag.getParentUIComponentTag(pageContext);
       if (componentTag == null) {
       throw new IllegalArgumentException(
       Messages.getMessage(Messages.NO_UI_COMPONENT_TAG_ANCESTOR_ERROR, "AjaxSupportTag"));
       }
      
       if (componentTag.getCreated()) {
       //Component was just created, so we add the Listener
       UIComponent component = componentTag.getComponentInstance();
       uiComponent.setParentProperties(component);
       }
       } catch (ClassCastException e) {
       // JSF 1.2 - tags have other parent.
       }
      
       }
      


      Besides the comment in the catch block, there seems to be no handling of JSF 1.2 tags. Are they supported already and I'm doing something wrong or is 1.2-support still work in progress? (using Ajax4JSF 1.1.1)

      Marty