Hello,
I'm new to
Struts and would like to ask for someone's help explaining the behavior of the logic:iterate tag.
I used the logic:iterate tag to display the contents of an ArrayList which are objects that contain a Hashtable which I display using another logic:iterate tag. However, when I tried to view the source after displaying the page, the outer </logic:iterate> tag seemed to be ignored, both the outer logic:iterate and the inner logic:iterate tags terminated when it encountered the closing inner </logic:iterate> tag. I used
Tomcat 4 for this.
Here is a snippet of my code:
Note: "timeRecords" is an attribute I set in my session.
<logic:notEmpty name="timeRecords">
<table border="4">
<th>
<bean:message key="timeRecord.date"/>
</th>
<th>
<bean:message key="timeRecord.timeIn"/>
</th>
<th>
<bean:message key="timeRecord.timeOut"/>
</th>
<th>
<bean:message key="timeRecord.timeIn"/>
</th>
<th>
<bean:message key="timeRecord.timeOut"/>
</th>
<th>
<bean:message key="timeRecord.timeIn"/>
</th>
<th>
<bean:message key="timeRecord.timeOut"/>
</th>
<th>
<bean:message key="timeRecord.totalWorkHours"/>
</th>
<logic:iterate id="timeData" name="timeRecords">
<tr>
<td>
<bean:write name="timeData" property="date"/>
</td>
<logic:iterate id="log" name="timeData" property="timeLogs"/>
<td>
<bean:write name="log" property="key"/>
</td>
<td>
<bean:write name="log" property="value"/>
</td>
</logic:iterate>
</tr>
</logic:iterate>
</table>
</logic:notEmpty>
Source after loading the page.
<snip>
<table border="4">
<th>
Date
</th>
<th>
Time In
</th>
<th>
Time Out
</th>
<th>
Time In
</th>
<th>
Time Out
</th>
<th>
Time In
</th>
<th>
Time Out
</th>
<th>
Total No. of Working Hours
</th>
<tr>
<td>
2004-04-20
</td>
<td>
18:00:00
</td>
<td>
22:00:00
</td> -----> a closing </tr> should have been found here
<tr>
<td>
2004-04-21
</td>
<td>
08:00:00
</td>
<td>
18:00:00
</td>
</tr>
</logic:iterate> -->This is the unparsed closing /logic:iterate
</table>
</body>
</html>
Any ideas as to what I am doing wrong?
Thank you very much.