Announcement Announcement Module
Collapse
No announcement yet.
array binding Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • array binding

    Does anyone know of an array (of objects) binding example preferably using a MultiActionController. I cannot see any examples in the sample web jpetstore and petclinic applications.

    I can see how the jsp binding works path="object[x}.element" but have found that on form submission the array objects are not being created when new array items have been created by javascript in the browser.

    Do I have to write a custom editor to handle this?

    James

  • #2
    this might help

    James,

    Take a peek at my thread that I just updated :

    forum.springframework.org/showthread.php?t=60039

    Basically, I had to write my own onBind to bind the form elements to the array.

    Hope this helps,
    Larry

    PS I tried to make that reference a real link but the forum software gives some yucky error message that I don't have enough posts to be allowed the privilege of putting url's in my post. Funny, I jump through hoops to use their software and to use their forums. Makes me wonder why i bother to use either one ...

    Comment


    • #3
      Hi Larry

      this is exactly what I have done by parsing the request parameters looking for object[x] names and then creating an array with the required number of objects. It then binds the objects correctly. I would have preferred to use a custom editor to do this but I could not get it to work.

      One thing that I noticed is that if a column in the table is invalid it posts an error like error.object[x]. This assumes that you have fixed length array. I wish it would leave the array index off when reporting the error.

      I like lot of aspects of spring mvc but array binding and validation seems rather limited.

      James

      Originally posted by SlowOldFatRunner View Post
      James,

      Take a peek at my thread that I just updated :

      forum.springframework.org/showthread.php?t=60039

      Basically, I had to write my own onBind to bind the form elements to the array.

      Hope this helps,
      Larry

      PS I tried to make that reference a real link but the forum software gives some yucky error message that I don't have enough posts to be allowed the privilege of putting url's in my post. Funny, I jump through hoops to use their software and to use their forums. Makes me wonder why i bother to use either one ...

      Comment

      Working...
      X