4 Replies Latest reply on Jul 23, 2007 8:55 PM by Tiago

    HtmlAjaxCommandLink problem

    Tiago Newbie

      Hi all,

      I'm creating ajax4jsf components dynamically (basically I'm only using HtmlAjaxCommandLink) and I'm getting an error during the rendering of the page (Caused by: java.lang.NoClassDefFoundError: org/ajax4jsf/ajax/html/HtmlAjaxCommandLink)

      Using directly a a4j:commandLink the error disappear (when I comment the HtmlAjaxCommandLink dynamic creating).

      I've also verified the lib (ajax4jsf) on the .ear archive and it exists.


      (the XHTML)

      ....
      <ui:composition ...>
      <ui:define name="menu">
       <h:form id="another_form">
       <h:panelGrid binding="#{navigationMenu.menu}" />
       <a4j:commandLink action="#{navigationMenu.doSomething}" value="hello..testing" />
       </h:form>
      </ui:define>
      </ui:composition>
      


      (the bean)
      @Name("navigationMenu")
      @Scope(SESSION)
      public class NavigationMenu {
      
       @Logger Log log;
      
       private UIComponent menu;
      
       public NavigationMenu() {}
      
       public UIComponent getMenu() {
       return menu;
       }
      
       public void setMenu(UIComponent menu) {
       this.menu = menu;
       }
      
       @Create
       public void init() {
      
       menu = new UIPanel();
      
       FacesContext context = FacesContext.getCurrentInstance();
       Application app = context.getApplication();
      
       HtmlAjaxCommandLink myLink = (HtmlAjaxCommandLink)app.createComponent(HtmlAjaxCommandLink.COMPONENT_TYPE);
       myLink.addActionListener(new ActionListener() {
       public void processAction(ActionEvent e) {
       log.info("making a test....");
       }
       });
       myLink.setValue("testing 1...2...3..");
      
       menu.getChildren().add(myLink);
      
       }
      
       public void doSomething() {
       log.info("doing something...");
       }
      }
      
      



      I don't get it, if the library is there what's the reason for the error?
      (maybe it's something easy, trivial but please help anyway)

      I'm currently using JBoss 4.2.0.GA + JBoss Seam 2.0.0.BETA1


      I've also downloaded the ajax4jsf source code and I didn't found any class related to HtmlAjaxCommandLink (there is UIAjaxCommandLink but don't have nothing important related with HtmlAjaxCommandLink), someone could explain the reason for that too? (the download source archive name was jboss-ajax4jsf-1.1.1-src.tar.gz)

      One more thing, could you point me good resources about adding dynamically JSF components. I've read something on java sun foruns, etc.. but there aren't any good start points about this subject?

      Thanks!

      Tiago Cavaleiro.


        • 1. Re: HtmlAjaxCommandLink problem
          Tiago Newbie

          Got the same error for creating dynamically <rich:tabPanel> (using new HtmlTabPanel();).

          Caused by: java.lang.NoClassDefFoundError: org/richfaces/component/html/HtmlTabPanel
           at org.sicrema.visual.NavigationMenu.init(NavigationMenu.java:68)
          



          Verified the .ear archive and the project library directories for richface 3.0.1 and it exists. (I think JBoss Seam by default comes with support for ajax4jsf and richfaces)


          And again when I create a <rich:tabPanel> explicitly on XHTML (facelets) it works.

          Is there something trivial that I'm missing? Please someone could give me a hand on this?

          Thanks.

          • 2. Re: HtmlAjaxCommandLink problem
            Tiago Newbie

            Nobody have (or had) this problem?

            Is there anyone that dynamically created JSF components? (in this case ajax4jsf JSF components)?

            Thanks anyway!

            • 3. Re: HtmlAjaxCommandLink problem
              Sergey Smirnov Master

              You have a deal with JBoss Classloader problem.

              Once you solve this problem you will face another one - JSF command component (link,button etc) must be accomplished with id defined explicitly.

              • 4. Re: HtmlAjaxCommandLink problem
                Tiago Newbie

                Hi!

                Thanks for your reply.

                But because I'm out of time I've changed the direction of the things.

                The dynamically controls I will be doing on the client side, with some javascript and I'll use the js:Function to refresh some of the controls. For the rest that isn't dynamically I will use richfaces :)


                Regards.