Results 1 to 2 of 2

Thread: can't directly bind to a List

  1. #1

    Default 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. #2
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

    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.

Posting Permissions

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