You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Barnett, Brian W." <bb...@scholarinc.com> on 2004/06/15 19:57:46 UTC
RE: using java.util.Map
Here is an example that we have used and it works:
<html:select property="schoolId">
<html:options collection="allSchools"
property="schoolId" labelProperty="schoolName"/>
</html:select>
-----Original Message-----
From: Henrique VIECILI [mailto:viecili@softplan.com.br]
Sent: Tuesday, June 15, 2004 12:00 PM
To: Struts Users Mailing List
Subject: <html:options> using java.util.Map
Does anyone know howto use the <html:options> tag with the values and label
inside a Map?
I´ve tried this:
<html:options name="myMap" property="key" labelName="myMap"
labelProperty="value"/>
but it didnt work...
Any sugestions?!
Henrique Viecili
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: using java.util.Map
Posted by Henrique VIECILI <vi...@softplan.com.br>.
Ok, but probably 'allSchools' is actually a collection of beans that have getSchoolId() and getSchoolName() methods, right?!
What I have is a java.util.Map like this:
Map states = new HashMap();
states.put("RS","Rio Grande do Sul");
states.put("SC","Santa Catarina");
states.put("PR","Paraná");
and i want to render something like this on my html
<select name="states">
<option value="RS">Rio Grande do Sul</option>
<option value="SC">Santa Catarina</option>
<option value="PR">Paraná</option>
</select>
I guess that is it,
Henrique Viecili
----- Original Message -----
From: Barnett, Brian W.
To: 'Struts Users Mailing List'
Sent: Tuesday, June 15, 2004 2:57 PM
Subject: RE: <html:options> using java.util.Map
Here is an example that we have used and it works:
<html:select property="schoolId">
<html:options collection="allSchools"
property="schoolId" labelProperty="schoolName"/>
</html:select>
-----Original Message-----
From: Henrique VIECILI [mailto:viecili@softplan.com.br]
Sent: Tuesday, June 15, 2004 12:00 PM
To: Struts Users Mailing List
Subject: <html:options> using java.util.Map
Does anyone know howto use the <html:options> tag with the values and label
inside a Map?
I´ve tried this:
<html:options name="myMap" property="key" labelName="myMap"
labelProperty="value"/>
but it didnt work...
Any sugestions?!
Henrique Viecili
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org