Hi:
  I have a bean contains a list within a list.  For example:

public class storeFront {
        
        private list<imageContentBox> imageContentBox;  
        

}

Public class imageContentBoxBean{
        private list<Employee> arrayList1;
        private list< Employee> arrayList2;
        
}

Public class Employee
{
        Private String name = "John";
        
        Public String getName()
        {
                Retrun name;
        }
}

How do I get the list within a list or array is fine too?  Please see
below on another foreach?  I think I am doing it wrong.

<f:facet name="layout">
    <tc:gridLayout columns="150px;300px"/>
</f:facet>
<c:forEach items="${storeFront.imageContentBox}" varStatus="content" >
    <tc:cell>
        <tc:out 
value="#{storeFront.imageContentBox[${content.index}].userGroupBoxImageI
d"/>
    </tc:cell>
    <tc:cell>
            <tc:out 
value="#{storeFront.imageContentBox[${content.index}].userGroupBoxImageT
ext"/>  
      </tc:cell>

        <c:forEach
items="${storeFront.imageContentBox[${content.index}].arrayList1}"
varStatus="contentArry" >
        <tc:cell>
            <tc:out 
        
value="#{storeFront.imageContentBox[${content.index}].arrayList1[${conte
ntArry.index}].name"/>  
      </tc:cell>

        </c:forEach>


</c:forEach>




If u need a better view of table alignment then use the following code
as such

<f:verbatim><table width="500px"></f:verbatim>
<c:forEach items="${storeFront.imageContentBox}" varStatus="content" >
    <f:verbatim>
        <tr valign="top">
            <td width="114px">
            </f:verbatim>
                <tc:out 
value="#{storeFront.imageContentBox[${content.index}].userGroupBoxImageI
d"/>
            <f:verbatim>

        </td>
       <td>
    </f:verbatim>
                <tc:out 
value="#{storeFront.imageContentBox[${content.index}].userGroupBoxImageT
ext"/>
    <f:verbatim>
          </td>
            </tr>
     </f:verbatim>
</c:forEach>
<f:verbatim></table></f:verbatim>

But this is not advisable to use html table code with Tobago

U can do the same with gridLayout as follows

<f:facet name="layout">
    <tc:gridLayout columns="150px;300px"/>
</f:facet>
<c:forEach items="${storeFront.imageContentBox}" varStatus="content" >
    <tc:cell>
        <tc:out 
value="#{storeFront.imageContentBox[${content.index}].userGroupBoxImageI
d"/>
    </tc:cell>
    <tc:cell>
            <tc:out 
value="#{storeFront.imageContentBox[${content.index}].userGroupBoxImageT
ext"/>  
      </tc:cell>
</c:forEach>

where ${storeFront.imageContentBox} is an List object , and  content is
an 
refernce for that.

So u can iterate as such with JSTL forEach tag.

Regards,
Madan


--> Sam Wong

Reply via email to