2 Replies Latest reply on Feb 5, 2007 10:03 PM by henrik.lindberg

    @DataModel confused over name...

    henrik.lindberg

      I am using a @DataModel annotation for a variable like this:

      @DataModel("availableCars")
      private List<Car> m_availableCars;
      


      and I have a factory model
      @Factory("availableCars")
      public void findCars()
       //...
      


      When I use this combination, the <h:dataTable> picks up the value ok, but when I use regular EL statments like:
      <h:outputText value="There are no cars to display" rendered="#{empty availableCars}"/>
      

      The text does not get rendered even when the factory method creates an empty List.

      After some testing, I notived that the Debug ouput page showed the bound variable m_availableCars, and not as I expected availableCars


        • 1. Re: @DataModel confused over name...
          henrik.lindberg

          (Sorry, hit submit instead of preview)...

          • 2. Re: @DataModel confused over name...
            henrik.lindberg

            I learned that using "empty" does not work here since the List is wrapped in a ListDataModel, and I need to use rowCount on that instead to test for empty.

            But something weird was still going on. In the debugger window I could see my variable m_availableCars and listed as being an Array - i.e. showing two empty brackets.

            Changing the name (i.e. removing m_) got my code working.

            But so, I thought. After restarting JBoss I could not reproduce the problem, and switching back to the "m_" notation worked.

            So - problem is solved.