I'm just using the following dummy data in my bean:
private String[] headings = {"User", "Job Group", "Job", "Spreadsheet",
"DataUpdated", "Status", "Submitted" };
private String[][] data = { { "1", "2", "3", "4", "true", "6", "7"},
{"8", "9", "10", "11", "false", "13",
"14"} };
I've got get and set methods for both properties and generate a table with
the following:
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<%-- Generate table headings --%>
<tr>
<struts_logic:iterate id="head" name="jobMonitorForm"
property="headings" scope="page">
<th><struts_bean:write name="head"/></th>
</struts_logic:iterate>
</tr>
<%-- Generate table data by nesting iterate tag --%>
<struts_logic:iterate id="rows" name="jobMonitorForm"
property="data" scope="page">
<tr>
<struts_logic:iterate id="element" name="rows">
<td class=row><struts_bean:write
name="element"/></td>
</struts_logic:iterate>
</tr>
</struts_logic:iterate>
</table>
Richard.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 4:52 PM
To: [EMAIL PROTECTED]
Subject: RE: nested logic:iterate tags
Richard,
What does the array look like? Can you post the logic for that array?
On Thu, 03 May 2001, Richard Murray wrote:
>
> Hi,
>
> For anyone interested I managed fix my problem with the following:
>
> <struts_logic:iterate id="rows" name="contributorList" property="data"
> scope="page">
> <tr>
> <struts_logic:iterate id="element" name="rows">
> <td><struts_bean:write name="element"/></td>
>
> </struts_logic:iterate>
> </tr>
> </struts_logic:iterate>
>
> Regards
>
> Richard
>
> -----Original Message-----
> From: Richard Murray [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 03, 2001 2:44 PM
> To: '[EMAIL PROTECTED]'
> Subject: nested logic:iterate tags
>
>
> Hi,
>
> I'm trying to generate a table of data from a 2 dimensional array of
Strings
> called ( String[][] data ). I am trying to use the struts tag
> <logic:iterate> to loop through the data and generate the table. As it is
a
> 2 dimensional array I have nested the iterate statements as follows:
>
> <struts_logic:iterate id="rows" name="contributorList" property="data"
> scope="page">
> <struts_logic:iterate id="data" collection="(Object[])rows">
> <td><struts_bean:write name="data"/></td>
>
> </struts_logic:iterate>
> </struts_logic:iterate>
>
> I get the following exception trying to run this:
>
> org.apache.jasper.compiler.CompileException:
> F:\projects\fcutc\deploy\fcutc\list.jsp(40,1) Unable to convert a String
to
> java.lang.Object for attribute collection
>
> I'm trying to use the id ("rows") from the first iterate statement as a
> variable in the second, however it seems it looks as though it is being
> treated as a string rather than a variable. I thought the id held the
> current object in the iteration, which in my case is an array.
>
> Hope someone can help. I'm pretty new to struts ( and JSP ) so I may have
> done something obviously wrong.
>
> Thanks.
>
> Richard Murray
> Software Engineer - Net Products Development
> QSP
> OLAS House, Team Valley Trading Estate,
> 5th Avenue Business Park,
> Gateshead, Tyne & Wear NE11 0XA
> Switchboard +44 (0) 191 402 3333
> Direct line +44 (0) 191 402 3329
> email [EMAIL PROTECTED]
> website www.qspgroup.com
> QSP - Enabling e-Finance
>
>
>
>
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager at [EMAIL PROTECTED]
>
> This footnote also confirms that this email message has been swept by
> for the presence of computer viruses.
>
> http://www.qspgroup.com
> **********************************************************************
Thomas Peters
Senior Software Engineer
Aidera Solutions
Cell: 603-566-5406
Voice Mail: 603-888-7700