DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6583>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6583

Default override values for action-mappings and exception handling

           Summary: Default override values for action-mappings and
                    exception handling
           Product: Struts
           Version: Nightly Build
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Controller
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


For example, when I want to set a property called "myProperty" for an action 
called "myAction", I have might have the following lines in my struts config:

  <action-mappings>

    <action path="/myAction"
            className="MyActionMapping"
            type="MyAction">
      <set-property property="myProperty" value="foo"/>
    </action>

  </action-mappings>

This works fine if you only want to override the default ActionMapping class 
once or twice, but if you want to override it globally, then you must always 
specify the "className" attribute.  If you forget to specify the "className" 
attribute, then the attempt to set the property "myProperty" will fail 
silently, leaving you confused when things don't work as planned.  I propose 
that an elegant solution would be to allow the user to specify the default 
ActionMapping class in the <action-mappings> tag.  So the above example would 
look more like this:

  <action-mappings className="MyActionMapping">

    <action path="/myAction"
            type="MyAction">
      <set-property property="myProperty" value="foo"/>
    </action>

  </action-mappings>

Now I can safely allow all of my Action classes to attempt a cast of 
ActionMapping to MyActionMapping and access the additional elements found 
inside.  I realize this is not a necessity, but it's a great great convenience.

It would nice to have a similar configuration mechanism for use with 
exceptions, where you could override the default ExceptionConfig and 
ExceptionHandler classes as follows:

<global-exceptions className="MyExceptionConfig" 
                   handler="MyExceptionHandler">

</global-exceptions>

I suppose this idea would be applicable in other areas as well.  (Maybe in 
message-resources, for instance.)

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

Reply via email to