File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes collect multiple values using logic:iterate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "collect multiple values using logic:iterate" Watch "collect multiple values using logic:iterate" New topic

collect multiple values using logic:iterate

sudheshna Iyer
Ranch Hand

Joined: Aug 20, 2004
Posts: 71
collect multiple values using logic:iterate

I have list of Objects. Each object has list of another Objects
class S{
private String sname;
private String sdesc;
private List tlist;//list of T classes
..all get/set methods for the above here....
class T{
private int tname;
private String tdesc;
..all get/set methods for the above here....

I have the following code in JSP:

<bean efine name="TForm" property="SList" id="SList"/>
<logic:iterate name="SList" id="soc" indexId="index">
<bean:write name="soc" property="sDesc"/>
<font face="Arial, Helvetica, sans-serif">
<bean efine name="soc" property="tlist" id="tlistforSoc"/>
<html:select property="seltname">
<html ptions collection="tipsListforSoc" property="tname" labelProperty="tdesca" />

A particular 'soc' has list of T's. User can select one T from the list of Ts. So I want to collect all the
Ts for all the Socs. What should the value of 'seltname' in the Form? Should that be an arraylist or array?
I have the following, but it is not working. I am not seeing the whole logic:iterate block on the screen.


private int[] seltname;

....all get/set methods here....

But I change this array to single value like the following, it works, but it collects only one value:

private String seltname;

I need to collect all the selected Ts for all Socs. Please help.
I agree. Here's the link:
subject: collect multiple values using logic:iterate
It's not a secret anymore!