Hubert Rabago wrote:
>What I had in mind was moving the "find which Action method to call
>then call it" logic to a utility class, so that if I needed that
>functionality, I could use it without having to inherit DispatchAction
>or one of its subclasses. This way, I wouldn't have to choose between
>having a BaseAction that's used by all the Actions in my application
>and one of the DispatchAction flavors.
>
I did this quite a while ago with
public class ImageTagUtil {
public static String getName(HttpServletRequest request) {
String command = null;
String buttonValue = null;
Enumeration enum = request.getParameterNames();
while(enum.hasMoreElements()) {
buttonValue = (String)enum.nextElement();
if(buttonValue.endsWith(".x")) {
command = buttonValue.substring(0,buttonValue.indexOf('.'));
}
}
return command;
}
}
at
http://wiki.apache.org/struts/StrutsCatalogMultipleImageTagsSimplified
. I just employed put it in SimpleDispatchAction to get the
reflection. If you do this with utils on the side, which seems like a
good idea but not good enough to bloat Struts with to me, then you have
to understand that this will not work for code that has used
DispatchAction, LookupDispatchAction or MappingDIspatchAction, because
those classes use different data.
Michael McGrady
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
|