Hi everyone,
Is there an eaxmple out there for displaying table data?
How do I use iterate? With the code below, it just prints Next element is
Thanks for any help.
Sunil
Here's my jsp:
Test.jsp:
<html>
<body>
<html:form
<table>
<logic:iterate id="row" name="TestForm" property="grid">
Next element is <bean:write name="row" property="value"/>
</logic:iterate>
</table>
<html:submit/>
</html:form>
</body>
</html>
My Form:
TestForm
public class TestForm extends ActionForm
{
private Vector grid = new Vector();
public TestForm() {
// Create the Grid
for (int i = 0; i < 3; i++) {
//Create a row
grid.add(new Row("key", "Cell (1)"));
grid.add(new Row("key","Cell (2)"));
grid.add( new Row("key","Cell (3)"));
}
}
/**
* Return the grid
*/
public Vector getGrid() {
return grid;
}
}
The Row class:
public class Row
{
private String key = null;
private String value = null;
public String getKey()
{
return key;
}
public String getValue()
{
return value;
}
public Row(String key, String value)
{
key = key;
value = value;
}
}
The Action class:
public class TestAction
{
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
// Validate the request parameters specified by the user
ActionErrors errors = new ActionErrors();
return (mapping.findForward("success")); //success maps back to test.jsp
}
}
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>