You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Ted Husted <hu...@apache.org> on 2006/08/21 22:41:19 UTC

Wildcarding the Bang (was Re: [s2] Freemarker transform name0

On 8/21/06, Patrick Lightbody <fo...@opensymphony.com> wrote:
> I'm still not yet on board with removing the ! syntax until we have a solid replacement. I
>don't think pointing to wildcards is enough, especially since you
would have to create a
>wildcard for every namespace.

Right now, the ! idiom is being controlled by a compatibility switch,
which seems like a good start to me. It puts people on notice that we
are looking for an alternative, but doesn't force application code to
be changed. Worse case, we leave the compatibility switch there
indefinately, and people who consider the aliases a security risk can
leave it off.

Meanwhile, we can try going bang-free in our own examples, and see how it goes.

I think a (XWork) feature that would make a big difference is
"extends", which is supported by several other frameworks with XML
configurations, including Spring, iBATIS, and Struts 1. With
"extends", actions start looking more like annotations.

<action name="Crud" class="mypackage.Crud" >
< .... >
</action>

<action name="Crud/Insert" extends="crud" method="insert"/>

In the second instance, "Crud/Insert" woud inherits all the results,
interceptors, exception hanlders, from the base, and just override
what needs to be overriden. It's something like having ad-hoc
packages. The sweet spot is that if you wanted to override the result,
or anything else here, you could, without affecting any of the other
entry methods.

Another sweetner would be a "class-ref" element. Here we could define
a nickname for a class, and then use the nickname any where the FQN is
used.

<class-ref name="Crud"
class="com.somewhere.myapplicatioin.mypackage.mymodule.Crud" >

....

<action name="Crud" class="Crud">

iBATIS and Spring both support this notion. With multiple config
files, you can then do things like define all your classes in one
place, and just use the class-ref name elsewhere. Besides eliminating
redundency, being able to define class-refs would be helpful when
defining wildcard patterns.

I'm frying other fish right now, but once the Struts 2.0.x milestones
start shipping, I'd like to see about adding "extends" and "class-ref"
to XW2. If the wildcards are not being inherited along with other
package settings, we should work on that too.

-Ted.

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