4 Replies Latest reply on Oct 21, 2006 7:11 AM by trouby

    PropertyNotFoundException exception with JSF binding

    trouby

      Hey,

      I have a list of objects that each object has a method named: 'getJsfPanelGridComponent' that returns an 'HtmlPanelGrid' initialized object.

      This list is outjected by seam to the facelets view,

      I iterate over this list with a normal 'datatable' tag, and I can see that the list gets iterated just fine.

      Then when I try to bind into a 'panelGrid' jsf tag a property per iteration, I get the following error:

      javax.faces.FacesException: javax.el.PropertyNotFoundException: /sample.xhtml @77,83 binding="#{myIteratedObj.jsfPanelGridComponent}": Target Unreachable, identifier 'myIteratedObj' resolved to null
      


      This is the code of the panelGrid tag I'm trying to bind per iteration:

      <h:panelGrid column="2" binding="#{myIteratedObj.jsfValuesFormElements}"/>
      


      If I do something like
      <h:outputText value="#{myIteratedObj.jsfValuesFormElements}">
      


      I can see that the it returns the 'HtmlPanelGrid' object just fine, like:
      javax.faces.component.html.HtmlPanelGrid@152942b
      javax.faces.component.html.HtmlPanelGrid@54cc39
      ...
      


      What could be the problem? if the object is accessible to facelets why when I try to use 'bind' property I get a null exception on the object cannot be found?


      Thanks guys,

      Asaf.

        • 1. Re: PropertyNotFoundException exception with JSF binding
          trouby

          Hey,

          As I understand, this is not a SEAM issue, iterated objects in datatable in JSF cannot be binded to UI components :-/

          Is there anything I can do? does seam has any pattern that can help me with rendering UI components based on the iterated objects in a list?

          I see it very useful as sometimes only the objects themselfs knows how they should look like.


          As alwyas - thanks a lot guys.

          Asaf.

          • 2. Re: PropertyNotFoundException exception with JSF binding
            gavin.king

            Whats an "iterated object". I have no idea what you are talking about here.

            • 3. Re: PropertyNotFoundException exception with JSF binding
              trouby

              My fault Gavin,

              I shortcut my explainations, i'm sorry, here:


              I have a LIST of my own 'Attribute' class objects, where each of the 'Attribute' typed object has a collection of 'Value'(my own class) objects.

              I outject to the view a LIST of Attribute objects and display some of their properties by the standard 'dataTable' tag.


              Now I want to have another dataTable (within the 'Attributes' datatable) which will display each 'Value' object.

              The problem is that I don't know how and what type of Validators/Converters or even UI Component to render for each 'Value' object since the way the 'Value' objects looks and their types dependen on many conditions.

              So I have a in 'Value' class a method that returns the correct 'UIComponent' type with its needed converters/validators....


              When I tried something like:

              <h:dataTable id="attributeList" var="attribute" value="#{attributeList}">
               <h:column>
               <h:dataTable id="valueList" var="value" value="#{attribute.values}">
               <h:column>
               <h:panelGrid binding="#{value.renderJsfGridComponent}"/>
               </h:column>
              </h:column>
              


              I recieved a "PropertyNotFoundException" over the 'value' iterated object. ( I guess this is because 'value' is iterated it is not allowed to be used for binding)


              The question is if there's any way of adding a UI Component dynamically somehow and if Seam may help (somehow) here...


              Hope this time it's a little bit more understandable.. :)
              Thanks...

              • 4. Re: PropertyNotFoundException exception with JSF binding
                trouby

                Hey,

                Solved this by creating special tags instead of using 'binding' per iterated objects.


                Thanks anyway.