Thanks Wendy.
I changed the variable names to make the example easier to understand and
must have dropped the closing brace. I learned about escaping special
charaters here:
http://courses.coreservlets.com/Course-Materials/pdf/struts/Struts-and-JSP2-EL.pdf ,
but as you have indicated, it's not required in this case. I have tried
your suggestions and I get the same result. According to the error message:
Cannot find bean under name [LabelValue[Jim Smith, 3]]
...it looks like the list is being pulled from the map like I want it to,
but instead of the actual list being used as collection to iterate, the tag
lib is calling toString() on the list, and looking for a bean under that
name. I have worked around it like this:
<html-el:select name="userForm" property="employee">
<c:forEach var="opt" items="${departmentMap['sales']}" >
<html-el:option value="${opt.value}" >
<c:out value="${opt.label}"/>
</html-el:option>
</c:forEach>
</html-el:select>
But if its possible to do it in a less verbose manner I'd like to.
Thanks Again,
Eric
----- Original Message -----
From: "Wendy Smoak" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Saturday, May 28, 2005 5:32 PM
Subject: Re: Using <html:options> tag with a Map
From: "Eric C. Hein" <[EMAIL PROTECTED]>
<html-el:options collection="\${departmentMap[\"sales\"]"
property="label" labelProperty="value"/>
Was this pasted in? You have a slash in front of the dollar sign, and the
ending curly brace seems to be missing in the collection attribute. I've
never seen escaped double quotes used in an expression, either.
Try just ${departmentMap.sales} for the collection. I'm not sure how
smart
it is, but if it "knows" departmentMap is a Map, it will use the correct
accessor. Alternately, try ${departmentMap['sales']}.
--
Wendy Smoak
---------------------------------------------------------------------
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]