The <html:options....> and <html:optionsCollection...> tags expect a
collection of beans - not String values.

If you put the values in beans then you it goes something like

    <html:select name="myForm" property="roleName">
         <html:optionsCollection name="myForm" property="roleList"
label="roleName" value="roleId"/>
    </html:select>


So you store the list of roles in your action form under the property
"roleList" and that contains a List of beans which
have roleName and roleId properties.

Niall

----- Original Message ----- 
From: "sean jones" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 13, 2004 5:00 PM
Subject: Using a java.util.List with a HTML:SELECT


>
> is it possible to use a java.util.List object with an HTML:SELECT control.
>
> import java.util.List;
> import java.util.ArrayList;
>
> public final class Roles extends Ojbect {
>     public Roles() {}
>     public static List getRoles() {
>          List r = new ArrayList();
>          r.add("ADMIN");
>          r.add("SUPERADMIN");
>          r.add("CLERK");
>          r.add("SUPERCLERK");
>          return r;
>     }
> }
>
> in jsp
>
> i would use
> <html:form action="....." >
> <html:select property="formprop">
>
> <!-- what goest inside the html:select aattribute -->
> <html:options......
>
> <html:select>
> </html:form>
>
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to