Date: 2004-09-15T00:13:03
Editor: MichaelMcGrady <[EMAIL PROTECTED]>
Wiki: Apache Struts Wiki
Page: StrutsCatalogSimpleDispatchAction
URL: http://wiki.apache.org/struts/StrutsCatalogSimpleDispatchAction
no comment
Change Log:
------------------------------------------------------------------------------
@@ -95,23 +95,22 @@
}
protected static String getMethodName(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('.'));
+ String methodName = null;
+ String buttonValue = null;
+ String parameter = mapping.getParameter();
+
+ if((parameter != null) && (parameter.endsWith(".x"))) {
+ methodName = parameter.substring(0,buttonValue.indexOf('.'));
+ } else {
+ Enumeration enum = request.getParameterNames();
+ while(enum.hasMoreElements()) {
+ buttonValue = (String)enum.nextElement();
+ if(buttonValue.endsWith(".x")) {
+ methodName = buttonValue.substring(0,buttonValue.indexOf('.'));
+ }
}
}
-
- if(methodName == null) {
- String parameter = mapping.getParameter();
- if(parameter.endsWith(".x")) {
- methodName = buttonValue.substring(0,buttonValue.indexOf('.'));
- }
- }
- return command;
+ return methodName;
}
protected Method getMethod(String name)
@@ -162,7 +161,7 @@
'''So, just mine (retrieve, fetch) the value of the [name].x request parameter for a
generic solution that covers links, form submits, images, and so on without requiring
struts-config.xml use and providing auto method calling via reflection. If you have
further questions, or don't understand the last sentence, reread the beginning of this
hurried presentation and ''see'' StrutsCatalogMultipleImageTagsSimplified .'''
-'''Please note that if you like configuring struts-config.xml and like
MappingDispatchAction, SimpleDispatchAction does everything that class does and
more.'''
+'''Please note that if you like configuring struts-config.xml and like
!MappingDispatchAction, !SimpleDispatchAction does everything that class does and
more.'''
'''Michael !McGrady'''
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]