[ http://issues.apache.org/struts/browse/STR-2864?page=comments#action_38035 ] Paul Benedict commented on STR-2864: ------------------------------------
After many moons, my way of accomplishing this addresses Craig's two main objections: 1) I proposed forwards being pointed to other forwards. I agree, that's a bad decision :-) I don't even know how I proposed it because it didn't seem workable anyway. 2) The id attribute is a W3C proposal/standard that specifies a *document*-wide unique identifier. We don't need something that global. So Ted and Martin have recommended the actionId attribute which provides uniqueness to the action mappings. What's left is still the action aliasing I really require. It's just too darn tough to manage links in XML and JSP and I'd rather refer to actions via a symbolic name. This patch only addresses the resolving of the id-based URLs. If it is accepted, I will then submit the html taglib patches which I have ready. One thing I forgot was how I used the "action:" prefix to specifically identify in a forward that it is not a straight URL, but an aliased URL. That's still open for suggestion. I didn't do that in my patch -- /person/edit.do or editPersonAction -- and so if the prefix notation helps, please raise that issue. > Add actionId attribute to action mapping > ---------------------------------------- > > Key: STR-2864 > URL: http://issues.apache.org/struts/browse/STR-2864 > Project: Struts 1 > Issue Type: Improvement > Components: Core > Environment: Operating System: other > Platform: Other > Reporter: Paul Benedict > Assigned To: Paul Benedict > Fix For: 1.3.6 > > Attachments: patch.txt, patch.txt, STR-2864.patch.txt, > struts-config.xml > > > Many times I need to redirect to another Struts actions. Recently I've come > across the problem of needing to rename my action paths but this became a real > nightmare to keep the action names as well as my redirect (forward) paths in > synchronization. > I propose adding an id attribute to the <action> tag so that it can be > referred > to in <forward> tags and its URL would be inferred, rather than be explicitly > listed out. I find this proposal also to work well as a replacement for global > forwards. > <action id="viewJournal" path="/journal/view" ...> > ... > </action> > <action id="saveJournal" path="/journal/save" ...> > <forward name="success" path="id:viewJournal" redirect="true" /> > </action> -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
