On Mon, 24 Jan 2005 18:37:35 +0100, Gianpiero Caretti <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > FYI, all of my Actions call a common setup function at the start of > > execute(), > > and one of the things it does is set an attribute "command" in the request > > with the value of getPath() called on the ActionMapping. > > FYI, that's exactly what I am doing rigth now! > As I use Jakarta Velocity I cannot use static fields such as > org.apache.struts.Globals.MAPPING_KEY (the
Please take a look at FieldMethodizer, which allows access to static fields from the template http://jakarta.apache.org/velocity/api/org/apache/velocity/app/FieldMethodizer.html >constant for > "org.apache.struts.action.mapping.instance"). So I am implementing this > solution. > > The only think I don't like with this solution is that the JSP writer has to > know the existence of the "command" attribute into request. Moreover if the > Action writer forgot to call the "setup" method the request attribute will not > set. > > If you use jakarta velocity, another easy and probably less restricted > solution could be to extend the StrutsLinkTool and register it into > toolbox.xml instead of the standar link tool: > > <tool> > <key>link</key> > <scope>request</scope> > <class>yourpackage.MyStrutsLinkTool</class> > </tool> > > regards, > gianpiero > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]