You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nani Jon <na...@yahoo.com> on 2002/08/28 08:53:45 UTC
iterate tag help.
Hi all:
Is there a way in struts <logic:iterate ... tag to be able wrap the values coming out of a collection (ArrayList) on a JSP?
Here is a sample of my JSP code which puts everything on the same <td>:
<tr>
<logic:present name="results">
<logic:iterate id="myFormArrayListElement" name="results" property="formArrayList" type="String">
<td valign="top" colspan="2"><span class="normal">
<bean:write name="myFormArrayListElement"/></span>
</td>
</logic:iterate>
</logic:present>
</tr>
Thanks in advance for your help.
Regards,
Nanijon.
---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
Re: iterate tag help.
Posted by John Raley <jb...@mindspring.com>.
If the elements of the list are just Strings (or other "atomic" types)
then you won't be able to break them down into sub-properties. If they
are composites (i.e. they have getFoo(), getBar(), etc.) you could write
these properties with:
<bean write name='myFormArrayListElement' property='bar'/>
etc.
Nani Jon wrote:
>Hi all:
>
>Is there a way in struts <logic:iterate ... tag to be able wrap the values coming out of a collection (ArrayList) on a JSP?
>
>Here is a sample of my JSP code which puts everything on the same <td>:
>
><tr>
> <logic:present name="results">
> <logic:iterate id="myFormArrayListElement" name="results" property="formArrayList" type="String">
> <td valign="top" colspan="2"><span class="normal">
> <bean:write name="myFormArrayListElement"/></span>
> </td>
> </logic:iterate>
> </logic:present>
> </tr>
>
>
>
>Thanks in advance for your help.
>
>Regards,
>
>Nanijon.
>
>
>
>
>
>---------------------------------
>Do You Yahoo!?
>Yahoo! Finance - Get real-time stock quotes
>
>
--
Check it out: Map -> JavaBean
http://dynclass.sourceforge.net/
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: iterate tag help.
Posted by Fabian Sommer <fa...@web.de>.
Hi Nani!
> Is there a way in struts <logic:iterate ... tag to be able wrap the
values
> coming out of a collection (ArrayList) on a JSP?
Afaik that's what it's for...
> Here is a sample of my JSP code which puts everything on the same
<td>:
>
> <tr>
> <logic:present name="results">
> <logic:iterate id="myFormArrayListElement" name="results"
> property="formArrayList" type="String">
You don't need property I think: name="MyArrayList" should name the
ArrayList you want to get iterated, id="newBeanName" is the bean name to
access the single elements of the ArrayList:
<logic:iterate id="result" name=" myFormArrayListElement" type="String">
> <td valign="top" colspan="2"><span class="normal">
> <bean:write name="myFormArrayListElement"/></span>
<bean:write name="result"/></span>
> </td>
> </logic:iterate>
> </logic:present>
> </tr>
>
>
I think that should work. A look at the struts developer documentation
explains exactly how to use the struts-tags.
Fabian
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>