You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Jasper Rosenberg (JIRA)" <ji...@apache.org> on 2013/09/17 21:54:53 UTC

[jira] [Created] (WW-4203) Allow disabling xwork creating null objects on a property level

Jasper Rosenberg created WW-4203:
------------------------------------

             Summary: Allow disabling xwork creating null objects on a property level
                 Key: WW-4203
                 URL: https://issues.apache.org/jira/browse/WW-4203
             Project: Struts 2
          Issue Type: Improvement
          Components: Core Interceptors
    Affects Versions: 2.3.15.2, 2.3.15.1
            Reporter: Jasper Rosenberg
            Priority: Minor


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.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira