Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-10552

RequestBody is unable to bind (merge) JSON formatted POST form data to existing Command Object

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.2.2
    • Fix Version/s: Waiting for Triage
    • Component/s: Core
    • Labels:
      None

      Description

      Please also see my own StackOverflow question on this:

      http://stackoverflow.com/questions/16473727/spring-3-ajax-post-request-with-requestbody-and-modelattribute-and-sessionatt

      In summary, wish to bind JSON request form data to an existing Command Object (so data is merged) with the JSON form POST data being merged (overwriting) those attributes of a superset of data already populated into Command object prior to Form presentation on view. The links above should provide sufficient illustration of the problem.

      It seems that @RequestBody is capable of using Jackson JSON converter to populate a new Command Object (which may have nested objects) with the form data, but unable to leverage @ModelAttribute to automatically write the attribute values into an existing Command object (either stored in session or retrieved again using @ModelAttribute at the method declaration level.

      This is a severe limitation for anyone wishing to use the Spring MVC framework and have full support for Form submissions with JSON request and response types.

        Attachments

          Activity

            People

            Assignee:
            sdeleuze S├ębastien Deleuze
            Reporter:
            arcseldon@hotmail.com Richard Seldon
            Last updater:
            Spring Issuemaster
            Votes:
            8 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Days since last comment:
              1 year, 20 weeks, 3 days ago