3 Replies Latest reply on May 28, 2007 9:55 AM by holicy

    Writing an ajax4jsf component without CDK

    holicy

      Can anyone give a SIMPLE example to demonstrate how to write a ajax4jsf component without making use of CDK.

      By the way, why there is no package "org.ajax4jsf.ajax.html" in source bundle? Where can I obtain codes in that package, e.g. HtmlAjaxSupport...
      Or they are not open source?

      Thanks in advance.

        • 1. Re: Writing an ajax4jsf component without CDK
          alexsmirnov

          You can create ajax component by hand, as any other. CDK is only decrease volume of a manual coding for a component properties, save/restore state, JSP/facelets tags, configuration files.
          Where Is not a propoetary package org.ajax4jsf.ajax.html , this classes generated by CDK.

          • 2. Re: Writing an ajax4jsf component without CDK
            holicy

            I am not familiar with CDK's template language as well as Maven.

            Since there are only a few documents for CDK, in the short term,
            it's better for me to develop components without CDK.

            I'm trying to making a component by copying a RichFaces component, i.e., SimpleTogglePanel.
            The only difference is the package name.
            I wrote a simple application making use of the component,
            but my server showed an error message in deploying time.

            ???: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
            javax.faces.FacesException: java.lang.UnsupportedOperationException
             at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:408)
             at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
             at org.apache.catalina.core.StandardContext.start(StandardContext.java:4336)
             at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
             at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
             at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
             at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
            ...


            I had tried the same thing on TogglePanel and it works fine.
            But when I tried to move on ToggleControl, the same error message occurred.

            I find out that ToggleControl and SimpleTogglePanel both extends AjaxActionComponent, so it might be the cause of the error message?

            How to solve this problem?

            p.s.
            My environment is Tomcat 6.0.10 + Sun JSF 1.2_04 P01 RI.

            • 3. Re: Writing an ajax4jsf component without CDK
              holicy

              AHA! After updating the version of JSF RI (to JSF 1.2_04 P02),
              the error message becomes more detailed and accurate.

              ???: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
              org.ajax4jsf.framework.resource.ResourceNotFoundException: Static resource not found for path css/simpleTogglePanel.xcss
               at org.ajax4jsf.framework.resource.ResourceBuilderImpl.createStaticResource(ResourceBuilderImpl.java:427)
               at org.ajax4jsf.framework.resource.ResourceBuilderImpl.createResource(ResourceBuilderImpl.java:256)
               at org.ajax4jsf.framework.renderer.RendererBase.getResource(RendererBase.java:131)
               at simple.renderkit.html.SimpleToggleControlTemplate.<init>(SimpleToggleControlTemplate.java:57)
               at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
               at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
               at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
               at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
               at java.lang.Class.newInstance0(Class.java:350)
               at java.lang.Class.newInstance(Class.java:303)
               at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:1001)
               at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:1073)
              ...

              I think I probably know the mistake.