Announcement Announcement Module
Collapse
No announcement yet.
How to bind objects of a collection? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to bind objects of a collection?

    Can you use the spring:bind tag inside jstl forEach? I don't think you can because of the nesting limitation? Then how does one bind objects in a collection? I've been using RequestUtils to pull the values out of the request, but what I hassle for anymore than a few items. Is there a better way? Is this what the BindUtil is for?

    fyi

    I have the following jsp which displays a table from the db with input fields. I want to submit this to my SimpleFormController. The controller's commandName is "statusCodes" and the commandClass is "java.util.Collection." I get the "put errors in model" exception when I put the bind tags in.

    Code:
    <c&#58;forEach var="row" items="$&#123;statusCodes&#125;" varStatus="status">
    <tr>
    <td>		
    <input type="text" name="tableAndColumn&#91;<c&#58;out value="$&#123;status.index&#125;"/>&#93;" size="20" value="<c&#58;out value="$&#123;row.comp_id.tableAndColumn&#125;"/>">
    </td>
    <td>
    <input type="text" name="value&#91;<c&#58;out value="$&#123;status.index&#125;"/>&#93;" size="7" value="<c&#58;out value="$&#123;row.comp_id.value&#125;"/>">
    </td>
    <td>
    <input type="text" name="meaning&#91;<c&#58;out value="$&#123;status.index&#125;"/>&#93;" size="20" value="<c&#58;out value="$&#123;row.meaning&#125;"/>">
    </td>
    </tr>
    </c&#58;forEach>
    Thanks,

  • #2
    Yes, you can.
    http://opensource.atlassian.com/proj.../browse/SPR-52

    Comment

    Working...
    X