Re: How to get the input action path?
Kishore Senji wrote: As I use Jakarta Velocity I cannot use static fields such as org.apache.struts.Globals.MAPPING_KEY 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 Thank you, I know it. Unfortunately it forces the Actions developer to wrap all necessary object with FieldMethodizer. In other words it means *another rule* to follow during development. As I work with 5-8 people team, I know by experience that less rules means better work. That's the reason why I prefer an approach like the extension of the StrutsLinkTool: one programmer extends it and the JSP/VM writers just know, as natural it is, they have an extended $link object into VM pages. NO RULES JUST FEATURES! Gp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the input action path?
[Gianpiero] 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. [Jeff Beal] You can use a custom RequestProcessor instead of a common Action method [...] Another trick is to write a base Action class with a final execute [...] Good, even if I prefer the first or your two option: the custom RequestProcessor solves the problem without forcing new rules and without forcing all my actions to derive from my base action. As I told in a previous email, I prefer solutions that don't force new rules into team. So, the custom RequestProcessor ensure a new feature into my application with no restricions, as well as, if you use Velocity, you just need *one* programmer extends the StrutsLinkTool and *all* the JSP/VM writers just know, as natural it is, they have an extended $link object into VM pages. As I already told: no rules, just features! Gp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Generic
Hi All, I need help about struts and tiles. I have an application using tiles and I have a jsp page that can be used as output page for several different actions. In this page I'd like to have a link to recall the input action (with different parameters). Something like ActionMapping.getPath() method. The problem is that I don't know how to identify the input action directly into the JSP! In other words, Let's suppose I have 2 actions: action path=/act1 ... forward name=success path=mypage.jsp/ /action action path=/act2 ... forward name=success path=mypage.jsp/ /action How can I get the /act1.do or /act2.do into the JSP page? I have tried request.getRequestURI() but, as I use tiles, I always receive the URI of the main layout page (E.g. /miro/pages/layout/mainLayout.jsp) Thanks for the help, gianpiero - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to get the input action path?
Hi All, I need help about struts and tiles. I have an application using tiles and I have a jsp page that can be used as output page for several different actions. In this page I'd like to have a link to recall the input action (with different parameters). Something like ActionMapping.getPath() method. The problem is that I don't know how to identify the input action directly into the JSP! In other words, Let's suppose I have 2 actions: action path=/act1 ... forward name=success path=mypage.jsp/ /action action path=/act2 ... forward name=success path=mypage.jsp/ /action How can I get the /act1.do or /act2.do into the JSP page? I have tried request.getRequestURI() but, as I use tiles, I always receive the URI of the main layout page (E.g. /miro/pages/layout/mainLayout.jsp) Thanks for the help, gianpiero - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the input action path?
[EMAIL PROTECTED] wrote: There will be a request attribute under the name org.apache.struts.action.mapping.instance. Call getPath() on that (after casting to an ActionMapping). It works! Thanks to all, Gianpiero - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the input action path?
[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 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 keylink/key scoperequest/scope classyourpackage.MyStrutsLinkTool/class /tool regards, gianpiero MyStrutLinkTool.java Description: java/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the input action path?
Gianpiero Caretti wrote: 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 And using into the VM files directly the methods: $link.inputAction and $link.inputActionPath - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]