try this if Map.value = { "myvalue", "mydesc", "myotherdata" }
<table>
<logic:iterate id="element" name="myhashtable">
     <tr>
         <td>Next element contains:</td>
         <logic:iterate id="strObj" name="element">

         <td><bean:write name="strObj" />   <!-- exceptionally form because
"bean" strObj is a String --> </td>
         </logic:iterate>
    <tr>
</logic:iterate>
</table>

try this if Map.value = new myRecord()
<table>
<logic:iterate id="element" name="myhashtable">
     <tr>
         <td>Next element contains:</td>

         <td><bean:write name="element" property="value"/>  </td>
         <td><bean:write name="element" property="desc"/>  </td>
         <td><bean:write name="element" property="otherData"/>  </td>
    <tr>
</logic:iterate>
</table>

----- Original Message -----
From: "SHURTLEFF,ROBERT (HP-FtCollins,ex1)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 12, 2001 5:33 PM
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]>

Reply via email to