« Return to Thread: http://struts.apache.org/dtds/struts-2.0.dtd needs to be updated

Re: http://struts.apache.org/dtds/struts-2.0.dtd needs to be updated

by matt.payne :: Rate this Message:

Reply to Author | View in Thread

No not backwards at all.  It is exactly how inheritance works.  A child is free to override in case it wants to provide its own implementation of something.

Sure a child package inherits things from the parent.  With that in mind a child can override settings.  
e.g child says given me you settings, except namespace="/x".  When a child does that, all this actions appear under /contextName/x.

A child can also redefine the interceptor stack for a package.  Say the interceptor stack for the parent package includes some security interceptor and is under namespace "/secure", and child is free to redefine that interceptor stack for the package so it does not to include the security interceptor and say the namespace ="/demo".  A child can do this without redefining all the actions again.  

In this light it would appear to be a bug, that "default-class-ref" couldn't be overriden by the children.

Matthew Payne

newton.dave wrote:
--- "matt.payne" <matthew.b.payne@gmail.com> wrote:
> Chris Pratt wrote:
> > On Jan 10, 2008 1:15 PM, matt.payne <matthew.b.payne@gmail.com> wrote:
> >> It would be a ton more useful if it could provide the default class for
> >> actions defined in a abstract parent package, where the implementation
> >> class for those actions was not specified.
> > I'm not sure what you mean by the "abstract parent package", otherwise
> > that seems like exactly what it does.  If you create a package in
> > struts.xml and define the default-class-ref, then create another
> > package that extends the first, it should inherit the
> > default-class-ref from the parent package.
> My expectation would be that child package would override
> "default-class-ref" and have that applied/substituted to the actions
> defined in the parent.

Isn't that sort of backwards to how inheritance works? A child package
defines behavior for it and its children, not its parents.

d.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org

 « Return to Thread: http://struts.apache.org/dtds/struts-2.0.dtd needs to be updated