You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2005/11/15 06:00:26 UTC
DO NOT REPLY [Bug 37479] -
Identify action paths and infer forwards
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37479>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=37479
------- Additional Comments From paul4christ79@yahoo.com 2005-11-15 06:00 -------
Created an attachment (id=16970)
--> (http://issues.apache.org/bugzilla/attachment.cgi?id=16970&action=view)
Proposed Implementation
I decided to take a crack at my own idea (and this is my first time submitting
a patch!) I did this with the current nightlies of Struts 1.3 and I had a
successful time of hammering out the code. I tested it locally and it works
pretty good, and there are a few additional suggestions I even have in mind.
Basically this patch allows forwards to be pointers to other actions or
forwards. I took a page out of the Spring handbook and used the protocol
notation to be a shorthand to indicate the type of forward. Forwards beginning
with "action:" reference an action mapping of the specified id; forwards
beginning with "forward:" reference another forward (either locally or
globally).
I find this an exciting patch because I've continuously come across these
cases:
[1] Most global forwards are nothing but redudant URIs to existing action
mappings. Instead of mapping them out twice or more (especially when they are
locall), just reference the id of the action. This in a sense can reduce -- or
even eliminate -- the need of global forwards.
[2] Sometimes it is too costly to go into the Java code and change the name of
an existing forward. Here I simply redirect the forward to another forward, as
an alias.
Here is an example:
<action-mappings>
<action id="home" path="/home" forward="/home.jsp" />
<action id="viewCatalog" path="/viewCatalog" forward="/catalog.jsp" />
<action id="addItem" path="/addItem"...>
<forward name="success" path="action:viewCatalog" />
</action>
<action id="confirmPurchase" path="/buy"...>
<forward name="success" path="action:home" redirect="true" />
</action>
</action-mappings>
Notice the new "id" attribute on the action. It's not really new -- it exists
in all the DTD mappings as an attribute -- but no one implemented its datapoint
in the Config modules. So I use that as an identifier.
I am dedicated to owning the time to bring out this solution for 1.3, if the
commiters think it's a good idea. Please give it a try.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org