Results 1 to 4 of 4

Thread: Spring:bind and nested objects

  1. #1

    Default Spring:bind and nested objects

    Hi

    1.I am using a multi action controller which loads a form

    i need to load the form which has nested object eg

    class parent{
    int id
    string name;

    Child x;
    Child y;

    }

    Class child{
    string addr1;

    }


    2. I tried using sping:bind to bind the input fields in jsp to the object when i submit the form it goes to a multi action controller.

    Problem is

    1. i am not able to retrieve the values from nested object child in m jsp
    2.when i submit the form it throws exception invalid child -null

    is there any thing i need to include in cotroller to get nested values ?


    thanks

  2. #2

    Default nested object

    eg




    <spring:bind path="company.address.street">
    Name: <input
    type="text"
    value="<c:out value="${status.value}"/>"
    name="<c:out value="${status.expression}"/>">
    <c:if test="${status.error}">
    Error codes:
    <c:forEach items="${status.errorMessages}" var"error">
    <c:out value="${error}"/>
    </c:forEach>
    </c:if>
    </spring:bind>
    when i submit
    in controller i get null address

    if address street has values it doenot get displayed in textbox

  3. #3
    Join Date
    Apr 2005
    Location
    Finland
    Posts
    314

    Default

    Please post also the SimpleFormController code... atleast "formBackingObject()" and "referenceData()" methods from it.

    FYI
    When you post code, use <CODE>your code here</CODE> tags (just replace the <> with brackets []. By this, the post is more readable.
    if a trainstation is where the train stops, what's a workstation...

  4. #4

    Default

    hi

    i am just calling

    showMyView(req,res) - which just set my cmpany object in request and forwards to my jsp page

    on submit i call

    saveMyValues(http..req,res,Company command) function

    both these functions are in multi action controller


    i can get simple values like command.getCompanyName() etc

    but if i bind company.address in my jsp ,on form submit i get null exception

Posting Permissions

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