struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arron Bates" <struts-u...@keyboardmonkey.com>
Subject Re: Invalid indexed property ?!
Date Thu, 29 May 2003 06:39:22 GMT
Instead of this tag...

    <html-el:multibox property="selectedDrinks[${drinkType}]">

...try this one...

    <html-el:multibox property="selectedDrinks(${drinkType})">

...basically the square breaces are for indexed properties. The round ones are
for maps. You're trying to drive a map based property, so use the round ones
instead. The JavaBean specification defines how these things should be done...
    http://java.sun.com/products/javabeans/

Arron.


>    <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 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"});
> 	}

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


Mime
View raw message