When I got my "WebWork In Action" book, I saw it had the ability to give
names to actions. This feature I wanted in Struts 1.x because my action
paths are usually 3-5 directories deep in a command-like pattern. I find
it very very difficult to keep my action configs, forwards, and JSP tag
use all in sync. You wouldn't believe it, but I also change my URIs
during development quite a lot and it is a management challenge to make
sure everything that should be changed, is.
So I wrote the code for myself and want to add it to SVN, but not
without first getting opinions on the idea. I have added an "alias"
attribute to the action mapping, which is recognized in forwards and the
tag libraries to refer to action mappings under a symbolic name.
Here's an example:
<action path="/member/person/account/load"...>
<set-property property="alias" value="loadAccountAction" />
<forward name="success" path="editAccountAction"
redirect="true" />
</action>
<action path="/member/person/account/edit"...>
<set-property property="alias" value="editAccountAction" />
<forward name="success" path="editAccountPage" />
</action>
Here there are two actions aliased editAccountAction and
loadAccountAction. Because I use Tiles, you also see an editAccountPage.
Notice how you can symbolically forward to an action, just like you can
a Tile. Likewise, in a JSP, you will see <html:form
action="editAccountAction">, and the same for <html:link>
I ate my own dog food and put this into an almost-ready production 1.3
app and it works out great. I can now localize all my URIs to the action
configs themselves, and refer to everything else symbolically. This
works even with ActionRedirect parametrization. I also tested with
modules. I also back-ported this into the old RequestProcessor. I very
much wanted this feature myself, so I want to commit it unless there is
a serious objection to it.
Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]