1 Reply Latest reply on Dec 9, 2010 12:44 PM by blabno

    RF 3.x CDK-Component with forEach

    Geraint Ascanis Newbie



      I recently started to test building a custom component utilizing the cdk maven archetypes as described in http://jroller.com/wesleyhales/entry/jsf_component_developmment_with_the. Everything works fine and a simple example with a component, displaying the value of a java.lang.String attribute was developed in no time. Thanks for this!


      But then I wanted to take a step further:

      I changed the "property"-classname of my custom component to "java.util.Collection" and assigned the content of a backing bean to it. This content is of type java.util.List<...myObject...> and the goal was to iterate over this attribute in my custom components .jspx


      I wasn't succesful and so I ask you experts around here: how do I manage to iterate over a components attribute values inside its .jspx file and access myObjects?


      I don't want to describe child tags in the page code as one will do with <rich:dataTable> et cterea. But sure want to use the same syntax, i.e.:


      in the page.xhtml


      <sis:customscroller values="#{backingbean.objectlist}" />



      and in the htmlCustomscroller.jspx

      {code:xml}      <f:clientid var="clientId"/>      <div id="#{clientId}" x:passThruWithExclusions="value,name,type,id">           Hello World           <c:forEach items="#{component.attributes['values']}" var="item" >                <div>                     #{item.name}                </div>           </c:forEach>           end #{component.attributes['values']}      </div> {code}


      Everything else of the generated code I left untouched.


      The #{component.attributes['values']} expression resolves to the right count of attributes and the component renders empty divs for every one of the entries.

      The generated markup after the "end" label displays the values right. But the #{item.name} expression is evaluated at compile time of the CDK and not at evaluating the page.


      Is anyone out there, who can help?

      Thanks in advance