I had to do the same thing. My bean model is Iterator. Everything WORKS.
Use nested iterate tags on the same name, BUT! you must call previous() in
nested iterate.
<logic:iterate id="dummy" name="groupModel">
<tr><jsp:setProperty name="groupModel" property="back"
value=""/>
<logic:iterate id="dummy2" name="groupModel"
length="2">
<td width="49%" valign="top">...
<jsp:getProperty name="groupModel"
property="procDescription"/>
</td>...
</logic:iterate>
</tr>
</logic:iterate>
Please notice:
1. Usage of length attribute in nested <iterate>;
2. Call to "hack" setProperty/back, which does something similar to
previous().
I think this SHOULD be fixed by Struts writers:
...EVERYTHING IS APPROXIMATE:
.... IterateTag.java...
boolean dontNext;
Tag tag = findAncestorWithClass( this, IterateTag.class);
if( tag != null && tag.getName().equals(getName()) ) { // we are in
nested iterate on the same name
dontNext = true; // parent tag also hasNext, otherwise how could we
come here?
}
... if( ! dontNext) // add this line
... next() ....
-----Original Message-----
From: SHURTLEFF,ROBERT (HP-FtCollins,ex1) [mailto:[EMAIL PROTECTED]]
Sent: 13 ??????? 2001 ?. 3:33
To: [EMAIL PROTECTED]
Subject: How to extract multiple columns of data in an <logic:iterate> tag ?
Assume that the ActionForm has the getter for the below "myhashtable" that
returns a Map.
Assume that the .value returns an Array of Strings (or whatever)
I want to build a <table> with 4 columns in it with the <logic:iterate> .
I copied the below code from the STRUTS Developers Guide:
<logic:iterate id="element" name="myhashtable">
Next element is <bean:write name="element" property="value"/>
</logic:iterate>
Assume that a typical record is like:
Map.key = "myKey"
Map.value = [ "myvalue", "mydesc", "myotherdata" ]
But, how do I get the 0th, 1st, 2nd, etc. columns data out of the .value?
Does this work?
<logic:iterate id="element" name="myhashtable">
Next element key is <bean:write name="element" property="key"/>
Next element value 0 is <bean:write name="element" property="value[0]"/>
Next element value 1 is <bean:write name="element" property="value[0]"/>
Next element value 2 is <bean:write name="element" property="value[0]"/>
</logic:iterate>
What if .value was a Class like
public class myRecord{
.getValue()
.getDesc()
.getOtherData()
}
How would you call the getters to get the data?
All help is appreciated.
Robert
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>