Announcement Announcement Module
Collapse
No announcement yet.
bind multiple checkboes with velocity Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • bind multiple checkboes with velocity

    Hi all,

    I want to bind multiple check boxes with velocity. I have written following code:
    #springBind("questionInfoTO.questionDetails[$count].options")
    #set($options = $status.value)
    #foreach($optionObj in $options)
    #set( $index = $velocityCount - 1 )
    #springBind("optionObj.optionName")
    #set($optionName = ${status.value})
    #springBind("optionObj.id")
    #set($id = ${status.value})
    <tr>
    <td>
    <input type="checkbox" name="user_answer" value="true">
    ></td>
    <td><b>${id}.</b></td>
    <td>$optionName</td>
    </tr>
    #end

    In controller, I am accessing user_answer as

    String[] user_answer = request.getParameterValues("user_answer");

    But I am getting nullpointerException..

    Can anybody point out where I am going wrong?
    Any help is appreciated..
    Thanks,

  • #2
    you can use the #springFormCheckboxes macro to make it a bit easier for you:
    http://www.springframework.org/docs/....html#d0e10790

    Regards,

    Comment


    • #3
      Dead link

      The above link is dead.

      Comment

      Working...
      X