This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Struts and the fly likes jstl mapped properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "jstl mapped properties" Watch "jstl mapped properties" New topic
Author

jstl mapped properties

Lee Wright
Greenhorn

Joined: Nov 29, 2004
Posts: 11
I'm hitting the following problem using mapped properties...

I have a map of objects where the key is a Product object and the value is a List of Product objects.
I loop through the objects and want to be able to select one or more items using a checkbox.

The looping works fine but the isSelected property never gets set:

<c:forEach varStatus="i" var="lineCode" items="${requestForm.linecodeItems}">
<tr>
<th> </th>
<th class="grey"><html-el:link action="/viewLinecode?selectedProduct=${lineCode.key.ID}"><cut value="${lineCode.key.productCode}"></cut></html-el:link></th>
<th scope="row"> </th>
<th scope="row"> </th>
<th scope="row"> </th>
</tr>
<c:forEach items="${lineCode.value}" var="product">
<tr>
<th class="grey" scope="row"><html:checkbox name="product" property="selected" value="true" indexed="true"/></th>
<th nowrap="nowrap" class="grey" scope="row"><html-el:link action="/viewLinecode?selectedProduct=${lineCode.key.ID}"><cut value="${lineCode.key.productCode}"/></html-el:link></th>
<th nowrap="nowrap" class="grey" scope="row"><html-el:link action="/viewLinecode?selectedProduct=${product.ID}"><cut value="${product.productCode}"/></html-el:link></th>
<td nowrap="nowrap" class="grey" scope="row"><cut value="${product.description}"/></td>
<td nowrap="nowrap" class="grey" scope="row"><cut value="${product.size}"/></td>
</tr>
</c:forEach>
</c:forEach>

Can anybody help???

Thanks in advance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60082
    
  65

Since this has more to do with the Struts tag than JSTL, moving to the Web App Frameworks forum.
[ December 11, 2004: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jstl mapped properties
 
Similar Threads
Selection Drop Down Question
how to populate formbean property using html:checkbox values
I cant set any values in my Action Form for Contact object:
pass jstl value to javascript
Passing row id from html table on jsp to Action Class in Struts