Results 1 to 2 of 2

Thread: Problems binding a collection

  1. #1

    Default Problems binding a collection

    Hi,
    OK I give up, I'm stuck ;(

    I have a form command object which has an array (columns). I want to present the values in 'columns' as list of radio buttons. The user then has to select one of the columns. This works fine if they select a radio button, but if they fail to select a value then then I can catch that okt, BUT when the form is redisplayed the column values array is empty. The relevant code I have in the jsp is...

    <c:forEach items="${myForm.columns}"
    var="column"
    varStatus="idx">
    <tr>
    <td>
    <spring:bind path="myForm.columnPos">
    <input type="radio" name="columnPos"
    value='<c:out value="${idx.index}"/>' />
    </spring:bind>
    <spring:bind path="myForm.columns[${idx.index}]">
    <c:out value="${status.value}"/>
    </spring:bind>
    </td>
    </tr>
    </c:forEach>

    How do I get the columns array to keep its values if the form submission fails in the formvalidator?

  2. #2

    Default OK, I solved it ;)

    <c:forEach items="${myForm.columns}"
    var="column"
    varStatus="idx">
    <tr>
    <td>
    <spring:bind path="myForm.columnPos">
    <input type="radio" name="columnPos"
    value='<c:out value="${idx.index}"/>' />
    </spring:bind>
    <spring:bind path="myForm.columns[${idx.index}]">

    //THIS seems to have done the trick
    <input type="hidden" name="columns" value="${status.value}"/>"
    //////////////////
    <c:out value="${status.value}"/>
    </spring:bind>
    </td>
    </tr>
    </c:forEach>

Similar Threads

  1. Replies: 0
    Last Post: Jan 11th, 2005, 10:45 PM
  2. Replies: 13
    Last Post: Dec 7th, 2004, 10:00 AM
  3. Replies: 2
    Last Post: Nov 20th, 2004, 10:26 AM
  4. Replies: 8
    Last Post: Sep 23rd, 2004, 01:12 AM
  5. Replies: 2
    Last Post: Aug 17th, 2004, 04:16 PM

Posting Permissions

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