You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by matthew yee-king <ye...@no-future.com> on 2002/11/13 12:24:18 UTC

how to dynamically generate select options from arrays

Hello list people

I'm using struts 1.0.

I have a User object with a string array availableGroups. I want to
generate a select options list from this array in a jsp. 

Using a session bean of type User named currentUser, I can iterate the
array like this:

<logic:iterate id="x" name="currentUser" property="availableGroups">
<br /><bean:write name="x" />
</logic:iterate>

but i can't work out how to do the same sort of thing but generating a
select list. Well i can, but not using struts taglibs!

Can anyone help?

cheers

matthew



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: how to dynamically generate select options from arrays

Posted by matthew yee-king <ye...@no-future.com>.
did a RTFM and solved it:

the session scope bean instance name is currentUser, the array is
availableGroups...

<html:select property="group">
         <html:options name="currentUser" property="availableGroups"/> 
</html:select>

(property="group" refers to a property in an ActionForm that deals with
this form)

cheers

matthew

On Wed, 13 Nov 2002 11:24:18 +0000
matthew yee-king <ye...@no-future.com> wrote:


> I'm using struts 1.0.
> 
> I have a User object with a string array availableGroups. I want to
> generate a select options list from this array in a jsp. 
> 
> Using a session bean of type User named currentUser, I can iterate the
> array like this:
> 
> <logic:iterate id="x" name="currentUser" property="availableGroups">
> <br /><bean:write name="x" />
> </logic:iterate>
> 
> but i can't work out how to do the same sort of thing but generating a
> select list. Well i can, but not using struts taglibs!
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>