3 Replies Latest reply on Jan 29, 2008 9:15 AM by xterm2

    dynamicaly add html components to a HtmlOrderingList

      Hello all. My first post here.

      I'm trying to add html components to a OrderingList threw a backingbean dynamically but I'm drawing a blank here.

      My view lookes like this

      ...
      ...
      <rich:orderingList binding="#{myBean.richComponentList}" listHeight="300" listWidth="350" />
      ...
      ...
      


      And in my backingBean I'm trying this:
      public HtmlOrderingList getRichComponentList() {
       //test richComponentList
       HtmlOutputText test = new HtmlOutputText();
       test.setTitle("title");
       test.setValue("value");
       test.setId("id");
       richComponentList.getChildren().add(test);
       return richComponentList;
      }
      


      I have checked all the trivial things I can think of (like that the get-method is called and that there is no misspelling and such).

      Facelets gives med this error message:
      CreateSurvey.xhtml @80,130 binding="#{myBean.richComponentList}": Exception getting value of property richComponentList of base of type : myPackage.myBean
      


      Anyone got a minute to help out?

      //Fredrik

        • 1. Re: dynamicaly add html components to a HtmlOrderingList
          maksimkaszynski

          Probably, you have NullPointerException because haven't initialized richComponentList yet. You need to first initialize richComponentList first, and then add child components to it

          • 2. Re: dynamicaly add html components to a HtmlOrderingList

            You've right. So I instantiated it like this:

            private HtmlOrderingList richQuestionList = new HtmlOrderingList();
            
            public HtmlOrderingList getRichComponentList() {
            
             //test richComponentList
             HtmlOutputText test = new HtmlOutputText();
             test.setTitle("title");
             test.setValue("value");
             test.setId("id");
             richComponentList.getChildren().add(test);
             return richComponentList;
            }
            


            And that got rid of the error message from facelets. No output text is rendered in the richOrderingList though. And no error message is outputed either. So I'm still stuck!

            Am I adding the component to the OrderingList in the right way?



            • 3. Re: dynamicaly add html components to a HtmlOrderingList

              oh... and nevermind the typo. The first line of code should read:

              private HtmlOrderingList richComponentList
              = new HtmlOrderingList();
              


              Just a cut and paste error from my part. Sorry...