Results 1 to 4 of 4

Thread: Binding form parameters on bean with collection property

  1. #1
    Join Date
    Aug 2004
    Location
    Amsterdam, The Netherlands
    Posts
    10

    Default Binding form parameters on bean with collection property

    I'm using a SimpleFormController with a bean that has a collection property. Consider for example a orders property (a List of Orders), on a Customer bean. Is it possible to bind the parameters on the nested Order bean using the standard property paths as request parameter names?

    In other words, will a form parameter name like
    Code:
    customer.order[0].productId
    result in a call like
    Code:
    customer.getOrder().get(0).setProductId
    What is the best approach here?
    Thanks!
    -paul.

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

  3. #3
    Join Date
    Aug 2004
    Location
    Amsterdam, The Netherlands
    Posts
    10

    Default

    Ok, thanks, this helped! I'm trying it out right now.

    Just out of curiosity, this seems to be implemented at the bind jsp tag level. I'm wondering wether a setProperty() on the BeanWrapper with a path like this would also work. So let's say
    Code:
    BeanWrapper bw = (...);
    bw.setProperty("person.addresses[2].street", "");
    -paul.

  4. #4
    Join Date
    Aug 2004
    Location
    Amsterdam, The Netherlands
    Posts
    10

    Default

    For the equally curious: my example above
    Code:
    BeanWrapper bw = (...); 
    bw.setProperty("person.addresses[2].street", "NY Blvd");
    works perfectly on both Arrays and Lists (ArrayLists). Cool.
    -paul.

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 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
  •