1 Reply Latest reply on Apr 19, 2010 4:46 PM by RayDeCampo

    component.getChilderen() does not include facelet tags

    801430
      Hi,

      I’m writing a function to export a dataTable to excel.
      Everything works fine! Except when my UIColumn has facelet tags inside.
      ....
      for (int nr = uiData.getFirst(); nr < uiData.getRowCount(); nr++) {
           List<UIComponent> children = abstractTableComponent.getChildren();
           xls.append("<tr>");
           for(UIComponent child : children){
                xls.append("<td>");
                xls.append(renderChild(new StringBuilder(), child));
                xls.append("</td>");
           }
           xls.append("</tr>");
      }
      ....
      
      public StringBuilder renderChild(StringBuilder builder, UIComponent component){
           builder.append(component.getAttributes().get("value"));
           if(component.getChildren() != null){
                for(UIComponent child : component.getChildren()){
                     renderChild(builder, child);
                }
           }
           return builder;
      }
      Example 1:

      <h:column>
      <f:facet name=”header”>
      email
      </f:facet>
      <h:outputText value=”#{e.person.email}” />
      </h:column>     

      Result: <table><tr><td>Pieter@gmail.com</td></tr></table>



      Example 2:

      <h:column>
      <f:facet name=”header”>
      email
      </f:facet>
      #{e.person.email}
      </h:column>     

      Result: <table><tr><td></td></tr></table>

      #{e.person.email} is not converted a a component, so it doesn’t have a value.
      My question is how to get the value of a Facelets component.

      Thanks in advance,
      Pieter

      Edited by: Pieter_Pareit on Apr 19, 2010 5:34 AM