RE: iterating thru a collection

2003-06-19 Thread Mark Galbreath
Looks like you need a Map, not a List.

Mark

-Original Message-
From: Natalie D Rassmann [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 19, 2003 7:47 AM
To: Struts Users Mailing List
Subject: iterating thru a collection


I need to iterate thru a collection and put it in an html-el:select field.
How do I go about doing this

My collection type looks like this

ArrayList options
int selectedOption

The ArrayList of options is the following type:

String label
int id

Can anyone help me???

Thanks in advance...




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: iterating thru a collection

2003-06-19 Thread Alen Ribic
Not to sure what is required here but for populating a select box options
with values and labels
I just create a java.util.List of beans.

e.g. Category bean

public class Category {
protected int id;
protected String name;
// getters/setters
}

Now you just load the List (e.g. categoryList of type java.util.List) into
the options/options tag specifying the value and label that will be
pulled out of the beans in the List. (e.g. value=Category.id;
label=Category.name)

something like that...:)
--Alen




- Original Message -
From: Mark Galbreath [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, June 19, 2003 2:49 PM
Subject: RE: iterating thru a collection


Looks like you need a Map, not a List.

Mark

-Original Message-
From: Natalie D Rassmann [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 19, 2003 7:47 AM
To: Struts Users Mailing List
Subject: iterating thru a collection


I need to iterate thru a collection and put it in an html-el:select field.
How do I go about doing this

My collection type looks like this

ArrayList options
int selectedOption

The ArrayList of options is the following type:

String label
int id

Can anyone help me???

Thanks in advance...




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]