Re: Index Based Names in Iterate Tag

2002-11-21 Thread Patrice
I think that you can use a scriplet to define the property name:

<% String property = null; %>


<% property = "select" + index; %>




Hope it helps
   Patrice

- Original Message -
From: "Cohan, Sean" <[EMAIL PROTECTED]>
To: "Struts (E-mail)" <[EMAIL PROTECTED]>
Sent: Thursday, November 21, 2002 2:44 PM
Subject: Index Based Names in Iterate Tag


> I want to present a collection of beans using the  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  tag to populate the select objects.  The
> collection parameter of  will have to the name of the
> attributes created above (i.e., "select1", "select2", "select3",...)
>
> How can I create the collection name in each  tag in the
jsp?
> Can I use the indexId of the Iterate tag somehow to create it?  For
example,
> something like:
>
>   
>   
> 
>   
>  
> labelProperty="description" />
>  
>   
> 
>   
>   
>
> 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:

> For additional commands, e-mail:

>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Index Based Names in Iterate Tag

2002-11-21 Thread Cohan, Sean
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  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  tag to populate the select objects.  The
collection parameter of  will have to the name of the
attributes created above (i.e., "select1", "select2", "select3",...)  

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

  
  
 
  
 
   
 
  

   
  

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:

For additional commands, e-mail:


--
To unsubscribe, e-mail:   
For additional commands, e-mail: