Announcement Announcement Module
Collapse
No announcement yet.
can't directly bind to a List Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • can't directly bind to a List

    I can't directly bind a List.

    in the request, I have
    Code:
    employmentHistory[0].employmentHistoryPK=
    employmentHistory[0].manager=fdsafdsa
    employmentHistory[0].position=dsaffdsa
    employmentHistory[0].salary=fdsafdsa
    Then I directly bind it to a List
    Code:
    List<EmploymentHistory> employmentHistory =.....
    
    ServletRequestDataBinder binder = new ServletRequestDataBinder(employmentHistory);
    
    binder.bind(request);
    The data is NOT binded to 'employmentHistory'.

    How to fix it ?

    Thanks.

  • #2
    With data binding request parameters are mapped to property fields of the target object. For example employmentHistory[0].foo translates to targetObject.getEmploymentHistory(0).setFoo(). In order for your example to work you need a target object to contain the employmentHistory.

    Comment

    Working...
    X