try this package org.apache.struts2.example;public class Bean {
protected String FullName;
protected String Title;}
<s:bean name="org.apache.struts2.example.Bean" var="listPeople">
<s:param name="FullName" value="'GIJoe'"/>
<s:param name="Title" value="'AmericanIndenturedServant'"/>
</s:bean>
<s:iterator value="listPeople" status="groupStatus">
<td><s:property value="FullName" /></td>
<td><s:property value="Title" /></td>
</tr>
</s:iterator>
Martin ______________________________________________
Verzicht und Vertraulichkeitanmerkung
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung.
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung
fuer den Inhalt uebernehmen.
Date: Fri, 29 Jun 2012 18:46:21 -0400
From: [email protected]
To: [email protected]
Subject: Struts Tag Iterator formatting issue using tables
I am having issues getting the Struts Iterator
Tag to format correctly. Any
help would greatly be appreciated as this seems very simple, but
clearly I missing something:
Here is my jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>Bulk Terminate</title>
</head>
<body>
<h1>Bulk Terminate</h1>
<table border="1" "width="100%">
<tr>
<td>Select User</td>
<td>Full Name</td>
<td>Job Title</td>
</tr>
<tr>
<s:iterator value="peopleList">
<tr>
<td><s:checkbox name="fullName" /></td>
<td><s:property value="fullName" /></td>
<td><s:property value="jobTitle" /></td>
</tr>
</s:iterator>
</tr>
</table>
</body>
</html>
This is what it looks like in a browser:
And here is the HTML code source:
<html>
<head>
<title>Bulk
Terminate</title>
</head>
<body>
<h1>Bulk
Terminate</h1>
<table
border="1" "width="100%">
<tr>
<td>Select
User</td>
<td>Full
Name</td>
<td>Job
Title</td>
</tr>
<tr>
<tr>
<td>
<tr>
<td
valign="top" align="right">
</td>
<td
valign="top" align="left">
<input
type="checkbox" name="fullName" value="true" id="fullName"
/><input type="hidden" id="__checkbox_fullName"
name="__checkbox_fullName" value="true" />
</td>
</tr>
</td>
<td>John
Doe0</td>
<td>Job
Title0</td>
</tr>
<tr>
<td>
<tr>
<td
valign="top" align="right">
</td>
<td
valign="top" align="left">
<input
type="checkbox" name="fullName" value="true" id="fullName"
/><input type="hidden" id="__checkbox_fullName"
name="__checkbox_fullName" value="true" />
</td>
</tr>
</td>
<td>John
Doe1</td>
<td>Job
Title1</td>
</tr>
<tr>
<td>
<tr>
<td
valign="top" align="right">
</td>
<td
valign="top" align="left">
<input
type="checkbox" name="fullName" value="true" id="fullName"
/><input type="hidden" id="__checkbox_fullName"
name="__checkbox_fullName" value="true" />
</td>
</tr>
</td>
<td>John
Doe2</td>
<td>Job
Title2</td>
</tr>
</tr>
</table>
</body>
</html>
Where did all the extra table rows and table
cells come from?