Hi, I was wondering why there's no way to assign multiple parameters to action mappings, and came with the following solution. Basically, the idea is to have something like: " <action path="/index" type="pl.wwtech.shared.struts.IndexAction"> <set-parameter name="test" value="value"/> <forward name="default" path="page.index"/> </action> " in struts.xml, then to be able to use it like: " System.out.println(mapping.getParameter("test","default-value")); System.out.println(mapping.getParameter("test")); " from Action subclass. Additionaly, getParameter returns value of the same type (limited) as default value, so it is possible to have: " float f = mapping.getParameter("test-float",0.0); long l = mapping.getParameter("test-long",0); "
It also implements a basic getAttribute / setAttribute scheme to allow for "mapping-scope" runtime-only attributes. Of course it can easily be modified (I volunteer if you want it) to support initialization from xml. I needed something like that on numerous occasions so I included it here. I have attached some code based on 1.1b2 - please review it and let me know if you want me to post the whole thing. I'm sure it's stable, we're already using it in a number of production projects. To quickly find all modified fragments search for "MMM" (case-sensitive). I'm not sure about the configuration code - I don't use the Digester normally, I know it works (heavily tested) but I'm not sure if it's the best (or most recommended) way to implement this. There's no freeze-checks because only name-value pairs are stored, so once added the parameters are effectively immutable (by design). Also, comments are lacking because the code is so basic they're not really needed. "//MMM" in various places can (should) of course be removed - my team use triple m as a kind of tag. Please let me know what you think - I need this (or similar) capability in Struts, and I would be gratefull if you could include it it nightlies or next beta. Greetings, Sebastian P. Markiewicz, WWTech (aka deacon Marcus) [EMAIL PROTECTED] tel +48 602 102750 fax +48 602 145786
ActionConfig.java
Description: Binary data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>