|
From: Colin S. <col...@ex...> - 2005-03-10 03:55:23
|
I've added a new resolver for the MultiActionController, ParameterNameMethodNameResolver. Unlike ParameterMethodNameResolver, which looks for a parameter like action=methodname where action stays constant, and the value is the method name, ParameterNameMethodNameResolver uses the very existene of a parameter name as an indication to map to a specific method. So feeding it the String mapping array "hello:goodbye", "validate", "colin:nina" for example would map to the 'goodbye' method if there was a param 'hello', to the 'validate' method if there was a parameter named 'validate', and to 'nina' if there is a parameter named 'colin'. The request parameter value is simply ignored, and the first match wins. This is useful when you have a bunch of submit buttons on a page, and need to be able to tell them apart. The value attribute of a submit button is also the display text, which is often localized, so it's not a great mechanism to have the same button name and use the value to tell the buttons apart. However, the name itself can be set different for each button, and then this resolver can map based on that. Colin |