Code in jsp
<table>
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Continent</th>
<th>Independence Year</th>
<th>Head Of State</th>
<th>Capital</th>
<th>Added/Edited by</th>
<th>Time of Edit</th>
<th>Edit</th>
</tr>
</thead>
<tbody>
<s:iterator value="list">
<tr>
<td><s:property value="Code"/></td>
<td><s:property value="Name"/></td>
<td><s:property value="Continent"/></td>
<td><s:property value="IndepYear"/></td>
<td><s:property value="HeadOfState"/></td>
<td><s:property value="Capital"/></td>
<td><s:property value="editedbyuser"/></td>
<td><s:property value="editdatetime"/></td>
<td>
<s:a action="editworld">
edit<s:param name="Code" value="Code"/>
</s:a>
</td>
<tr>
</s:iterator>
</tbody>
</table>
Generated HTML(only for one row)
<tr>
<td>ABW</td>
<td>Aruba</td>
<td>North America</td>
<td>Unknown</td>
<td>Beatrix</td>
<td>Oranjestad</td>
<td>Unedited</td>
<td>Unedited</td>
<td>
<a href="/Struts2Login/editworld.action?Code=ABW">edit</a>
</td>
</tr>
<tr> </tr>
In the last line above that <tr></tr>
is an extra row .I am unable to understand how is this generated.Each time this <tr></tr>
is generated after each actual row.please help me out.
first close
<tr> </s:iterator>
that is open in last where it shold close
try this
<s:if test="%{list!=null"}>
<s:iterator value="list">
<tr>
<td><s:property value="Code"/></td>
<td><s:property value="Name"/></td>
<td><s:property value="Continent"/></td>
<td><s:property value="IndepYear"/></td>
<td><s:property value="HeadOfState"/></td>
<td><s:property value="Capital"/></td>
<td><s:property value="editedbyuser"/></td>
<td><s:property value="editdatetime"/></td>
<td>
<s:a action="editworld">
edit<s:param name="Code" value="Code"/>
</s:a>
</td>
<tr>
</s:iterator>
</s:if>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.