You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Manav Gupta <Ma...@cramer.com> on 2003/10/10 18:24:35 UTC

HashMap with options

Hi
 
Can i use HashMap with options?
 
something like:
 
<bean:define id="statusFilters" property="statusFilters"
type="java.util.HashMap" />
<html:options collection="statusFilters" property="key"
labelProperty="value"/>
 
such that the option value is the key and the labelProperty is the value?
 
thanks
M

Re: HashMap with options

Posted by "Michael D. Norman" <mi...@probusoft.com>.
> Manav wrote:
>
> Can i use HashMap with options?
>
> something like:
>
> <bean:define id="statusFilters" property="statusFilters"
> type="java.util.HashMap" />
> <html:options collection="statusFilters" property="key"
> labelProperty="value"/>

Manav,

Yes, you should be able to use any Map as the collection, with the
attributes you have defined above for <html:options.../>.  However, your
<bean:define.../> needs a name attribute if you're going to use the property
attribute.

-- Michael D. Norman
   ProbuSoft - Custom Software Development
   http://www.probusoft.com/
   913-390-6951
   michael@probusoft.com



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: HashMap with options

Posted by Sgarlata Matt <sg...@bah.com>.
You might want to investigate using a List of LabelValueBean objects
instead.

Matt
----- Original Message ----- 
From: "Manav Gupta" <Ma...@cramer.com>
To: "Struts Developers (E-mail)" <st...@jakarta.apache.org>
Sent: Friday, October 10, 2003 12:24 PM
Subject: HashMap with options


> Hi
>
> Can i use HashMap with options?
>
> something like:
>
> <bean:define id="statusFilters" property="statusFilters"
> type="java.util.HashMap" />
> <html:options collection="statusFilters" property="key"
> labelProperty="value"/>
>
> such that the option value is the key and the labelProperty is the value?
>
> thanks
> M
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org