You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Lee <ml...@hotmail.com> on 2002/09/12 19:52:56 UTC

HELP! html:options with a hashmap

I posted this before but haven't heard anything. Thought I would put up the error message too. What name do I put for name? The examples don't use a hashmap (seems logical for 'options'). When I put name it does the name and value. I want it to put the name under name and value under value, not both in the drop down.

I want to populate an <html:select> with data from a Map (HashMap). I have

...
<% pageContext.setAttribute("allUserRoles", Lookup.getData(Constant.USER.USER_ROLES)); %>
...
    <bean:message key="prompt.user.role"/>
    <html:select property="userRole" size="1">
      <html:options collection="allUserRoles"/>
    </html:select>

I don't see an example in the struts-exercise-taglib.war under html:select
It is vector or Object[].
Ideas?
thanks,
Mike

<Sep 12, 2002 1:48:29 PM EDT> <Error> <HTTP> <[WebAppServletContext(2285117,rece
iptsplus,/receiptsplus)] Servlet failed with Exception
java.lang.IllegalArgumentException: No name specified
        at org.apache.struts.util.PropertyUtils.getNestedProperty(PropertyUtils.
java:405)
        at org.apache.struts.util.PropertyUtils.getProperty(PropertyUtils.java:4
53)
        at org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:230
)
        at jsp_servlet.__create_user._jspService(__create_user.java:395)
        at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)