Announcement Announcement Module
Collapse
No announcement yet.
How to provide data for the formview Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to provide data for the formview

    I extended SimpleFormController to handle a form with several dynamic menus. I need to pass the menu items to the formview but I can't figure out how to do it.

    When I call my controller with a GET the methods that are called are formBackingObject() and referenceData() but there does not appear to be a method that will provide data for the form.

    Do I need a different controller for a form of this type or am I missing something fundamental about formview processing.

    Thanks for any help or guidance,
    -=beeky

  • #2
    you alread have the answer

    Originally posted by Wm Stafford View Post

    When I call my controller with a GET the methods that are called are formBackingObject() and referenceData() but there does not appear to be a method that will provide data for the form.
    -=beeky
    actually those are the methods to provide data for the form.

    Comment


    • #3
      the answer is not obvious

      genedelisa,
      I'm glad to hear that I have the answer but I still don't understand.
      It appears to me that formBackingObject() is used to handle INCOMING data, i.e. map it to an object. referenceData() does look like a likely suspect but it returns a map. How does the map get into the request so a jsp can access it?

      This may seem clear to experienced Spring MVC users but it is pretty opaque to me.

      Thanks for any clarification,
      -=beeky

      Comment


      • #4
        Download the whole Spring distribution and study the examples.

        FormBackingObject method is called during GET and POST. FBO returns so called commandObject which is your object e.g. Person. ReferenceData method is called only during GET and it returns a Map which migh contain some additional data relating the Person object (e.g. lists and other data).

        Comment


        • #5
          Still in the dark

          noon,
          Thanks for the reply, I have been reading through the source but I still don't know the answer to my original question.

          Let me restate it: When my controller receives a GET request I want to pass several lists of menu items to the formview. I just can't see how this is done since the methods called when the controller receives a GET do not seem to access the request or anything else that the view could also access.

          I'm sure the answer is really simple but I still don't see it.

          -=b

          Comment

          Working...
          X