Announcement Announcement Module
Collapse
No announcement yet.
<Spring:bind> and constructing form backing object Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • <Spring:bind> and constructing form backing object

    We are beginning to use Spring in our j2ee application and have a few questions.
    If I want to show a new form based on a complex nested object (for example A.B.C), I must fully construct it in formBackingObject() :

    new A(...,new B(..., new C(...)))

    If i construct the object only as

    new A()

    , it leads to NullValueInNestedPathException. Is our way showing new empty form the only one ?

    And what about the opposite direction? What if C can be null and I don't fill its atributes in form? I get again in onSubmit() full object A.B.C, not only A.B with C set to null.

    Is our way right or all this could be done better and simplier ?
    Thanks.

  • #2
    Unfortunately that is currently the way things work. To solve this problem:
    And what about the opposite direction? What if C can be null and I don't fill its atributes in form? I get again in onSubmit() full object A.B.C, not only A.B with C set to null.
    You'll have to have some way of "trimming" empty children from your object tree after going through the binding process.
    Please see/vote for SPR-1671 so that this issue gets resolved

    Comment

    Working...
    X