I posted this before, but I didn't even get a response saying it was a dumb question, not worth answering, so I'll ask again because I am desperate.
I've got to finish this up soon, and I am stumped.
Again, sorry for the length - I just want to be clear.


I have a form that need to collect some information about a user, using checkbox groups like so:
Bourbon
[] Jim Beam
[] Makers Mark
[] Blantons


Scotch
[] Johnnie Walker
[] Macallan
[] Lagavulin

Beer
[] Budweiser
[] Heineken
[] Duvel

Users can select 0 or more from each category, and I would like to use multibox to create the checkbox groups.
I created a HashMap of String[]s like so:
public HashMap getDrinksList() {
drinks = new HashMap();
drinks.put("Bourbon", new String[]{"Jim Beam","Makers Mark","Blantons"});
drinks.put("Scotch", new String[]{"Johnnie Walker","Macallan","Lagavulin"});
drinks.put("Beer", new String[]{"Budweiser","Heineken","Duvel"});
}


In my ActionForm I have:
        private HashMap drinkPrefs = getDrinksList();
        private String[] selectedDrinks;

        public String[] getSelectedDrinks(String key) {
                if(drinkPrefs.containsKey(key)) {
                        return (String[]) drinkPrefs.get(key);
                } else {
                        return new String[]{};
                }
        }
        
        public void setSelectedDrinks(String key, String[] selDrinks) {
          drinkPrefs.put(key, selDrinks) ;
        }

In my jsp I have:
<c:forEach var="drinkType" items="${drinksList.keySet}"><!-- there is wrapper method for .keySet() -->
<h3><bean:write name="drinkType"/></h3>
<c:forEach var="drinkItem" items="${drinksList[drinkType]}">
<html-el:multibox property="selectedDrinks[${drinkType}]">
<bean:write name="drinkItem"/>
</html-el:multibox>
<bean:write name="drinkItem"/>
</c:forEach>
</c:forEach>


I would expect to get a list of checkbox groups like I laid out above, but instead I get:
java.lang.IllegalArgumentException: Invalid indexed property 'selectedDrinks[Bourbon]' at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUt ils.java:404)...etc etc.



What am I doing wrong? Where can I get more detailed information about multibox and indexed properties?



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to