At 1:45 AM -0700 8/20/06, Paul Benedict wrote:
The key attribute of set-property reads:

    Since Struts 1.3, an alternate syntax is supported.  By using
    the "key" attribute instead of the "property" attribute, you can set
    arbitrary string properties on the Config object which is populated
    based on the containing element.   NOTE: the "key" attribute is NOT
    supported for <set-property> inside a <plug-in> element.

I might be glossing over a difference here, but how is this "alternative syntax" better or different than the "property" attribute? It highlights the "arbitrary string properties" feature, but I don't have problems with "property" for the same thing.

This is not simply alternative syntax. It is an alternative method for handling configuration. Before "arbitrary string properties," one was obliged to subclass the config object and add JavaBean properties with setters and getters. This led to a fair amount of boring code and configuration, including trivial subclasses, extra lines in struts-config.xml to specify the config object subclass, casts in Action classes when trying to read these values...

The addition of a "properties" object to all of the config objects reduces all of that clutter. It also makes it more plausible, in my mind, to have Struts itself accept configuration with a little less "commitment" - for example, the ComposableRequestProcessor allows for an alternative implementation of ActionContext to be specified using an "arbitrary property" (ACTION_CONTEXT_CLASS). Since this area is still possibly subject to change/improvement, I find this more palatable than changing the ControllerConfig class and the DTD to have this provided as a bean property of ControllerConfig.

Hope that helps to clarify things a little bit.

Joe


--
Joe Germuska
[EMAIL PROTECTED] * http://blog.germuska.com

"The truth is that we learned from João forever to be out of tune."
        -- Caetano Veloso

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to