You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "SHURTLEFF,ROBERT (HP-FtCollins,ex1)" <ro...@hp.com> on 2001/12/13 02:33:00 UTC
How to extract multiple columns of data in an 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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Problem with Logic-iterate and enumeration
Posted by "struts (H2Opilot)" <st...@h2opilot.de>.
hi,
I have a List of Numbers and I like to use 3 columns and n rows.
Is there a possible way to realise this via Logic-iteration.
Normally, it look like that every next step in the iteration there is
always another row.
Like this:
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<logic:iterate id="element" name="bla_f" property="numberss"
type="app.Data">
<tr bordercolor="#333366">
<td>
<bean:write name="element" property="number"/>
</td>
<td>
****** this should be the next element of Data, but how increment the
element?? *****
<bean:write name="element" property="number"/>
</td>
</tr>
</logic:iterate>
</table>
any ideas?
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How to extract multiple columns of data in an tag ?
Posted by Don Saxton <ds...@pacbell.net>.
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)" <ro...@hp.com>
To: <st...@jakarta.apache.org>
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:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>