Where I say indexOf below, I meant to say indexId.  Thanks again.

-----Original Message-----
From: Cohan, Sean [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 8:44 AM
To: Struts (E-mail)
Subject: Index Based Names in Iterate Tag


I want to present a collection of beans using the <logic:iterate> tag.  One
of the fields in the collection is another collection of beans.  This second
collection of beans I want presented in an html select object.  In my Action
Class, I'd like to iterate through the first collection creating http
request attributes, each one containing an instance of the second
collection.  Something like this:

List list = (List) getList();
Iterator it = list.iterator();

for (i=1; it.hasNext(), i++) {
  MyBean myBean = (MyBean) it.next();
  request.setAttribute ("select"+ i, (List) myBean.getOtherList());
}

I want to use the <html:options> tag to populate the select objects.  The
collection parameter of <html:options> will have to the name of the
attributes created above (i.e., "select1", "select2", "select3",...)  

How can I create the collection name in each <html:options> tag in the jsp?
Can I use the indexId of the Iterate tag somehow to create it?  For example,
something like:

  <table border="0" cellpadding="0" cellspacing="0" >
  <logic:iterate ...>
    <tr> 
      <td>
         <html:select property="key">
           <html:options collection="select" + indexOf property="id"
labelProperty="description" />
         </html:select>
      </td>
    </tr>
  </logic:iterate> 
  </table>

I know my use of indexOf can't be right.  I'm just trying to show the idea
of what I'm trying to do.


Thanks.



--
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