Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4203

Allow disabling xwork creating null objects on a property level

    XMLWordPrintableJSON

    Details

      Description

      Currently, the ParametersInterceptor sets: ReflectionContextState.setCreatingNullObjects(contextMap, true)

      This is great for parameters like "person.name=Phil" since it will create the Person object for you and then set the name.

      However, sometimes you have a converter for a property that will set it as a whole, and you want to make sure that an empty object is never created. For example, "person=6", where the Person is set by looking it up by id. Currently, if someone messed with the url and made it "person[x]=6", XWork would end up creating an empty Person object. (Something along these lines happened to us and I was looking for a clean way to tell XWork to not allow it)

      Perhaps the TypeConversion annotation could be extended to support this as an additional flag.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              perfnorm Jasper Rosenberg
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: