struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Reumann" <ric...@gmail.com>
Subject Some extra eyes to see where I'm screwing this code up...(form with Map property where keys-String, values-String[])
Date Mon, 24 Apr 2006 18:44:27 GMT
Thanks for any help...

Here's what the html page output looks like:

Product Roles
-------------

SomeProduct
    [] INTERNALAUTHOR    []EXTERNALAUTHOR

SomeProduct2
    [] INTERNALAUTHOR    []EXTERNALAUTHOR

SomeProduct3
    [] INTERNALAUTHOR    []EXTERNALAUTHOR


Backing this output is an ActionForm with the property:

HashMap productRolesMap;
//there is also a Map with this same name put into
//request scope

The ActionForm map has the keys set to the "productId" (number as a String)
and the value is a String[]. When the form submits I just want to
have the form's productRolesMap set with the String[] of the
selected roles. (Since these aren't boolean properties, all I need
is the values of the selected items).

Below is the code I was trying to use and it's working fine for
displaying the intial set of information (correct items are checked
and unchecked). The problem is when it submits, the String[] arrays in
the Map are not being updated at all.

The setter for the productRolesMap is called, but apparently the new
values selected are not being reflected in this Map.

The code I'm working with:

<c:forEach var="productMapItem" items="${productRolesMap}" varStatus="pStatus">
    <b>${productMapItem.key.productName}</b>
    <div style="padding-left:15px;">
        <c:forEach var="role" items="${productMapItem.value}">
            <html:multibox name="authenticateForm"
                 property="productRolesMap.${productMapItem.key.productId}">
                    ${role}
            </html:multibox>
            ${role}&nbsp;&nbsp;
        </c:forEach>
    </div>
    <br/><br/>
</c:forEach>


A snippet of the resulting html looks like:

<input type="checkbox" name="productRolesMap.2" value="INTERNALAUTHOR">
INTERNALAUTHOR


<input type="checkbox" name="productRolesMap.2" value="EXTERNALAUTHOR"
checked="checked">
EXTERNALAUTHOR

I'm sure it's something stupid that I'm doing wrong. (Isn't it always:)

--
Rick

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


Mime
View raw message