Results 1 to 2 of 2

Thread: How to bind objects of a collection?

  1. #1

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

Similar Threads

  1. Replies: 0
    Last Post: Jul 25th, 2005, 08:48 AM
  2. Replies: 0
    Last Post: Jan 6th, 2005, 08:19 AM
  3. Replies: 13
    Last Post: Dec 7th, 2004, 10:00 AM
  4. Replies: 8
    Last Post: Oct 3rd, 2004, 09:21 AM
  5. Replies: 8
    Last Post: Sep 23rd, 2004, 01:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •