Michael McGrady wrote:
Note, Ben, that in LookupDispatchAction we do the following:
Used the mapping attirbute parameter "method" to find "Delete It" in the request object name/value parameter pair "method='Delete It'". Created a reverse map of all the keys in the application resource property file for the users locale which allowed us to get "button.delete" from the key "Delete It". We are not yet done. We then use the value "button.delete" as the key in a map we have coded into our LookupDispatchAction subclass to get the value "delete". If this seems like a good idea to you, then we think differently. All l have to say about this is "WHEW!". LOL
Note also that, instead of following that lonesome Chisholm Trail, we can simply do the following:
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; }
And get the value of the method from either <input type='submit' name='create.x' value='create"> or <input type='image' name='create' src='create.gif'>. This is the solution I offer called ImageTagUtil. If you don't like mining the value ".x", you can use your imagination. I mine the value "dispatch" instead of ".x" in much of what is on my site.
Cheers,
Michael
public static String getName(HttpServletRequest request) { String methodName = null; String buttonValue = null; Enumeration enum = request.getParameterNames(); while(enum.hasMoreElements()) { buttonValue = (String)enum.nextElement(); if(buttonValue.indexOf(".dispatch") >= 0) { methodName = buttonValue; break; } } return methodName.substring(0,methodName.indexOf('.')); }
public static String getName(HttpServletRequest request) { String methodName = null; String buttonValue = null; Enumeration enum = request.getParameterNames(); while(enum.hasMoreElements()) { buttonValue = (String)enum.nextElement(); if(buttonValue.indexOf(".dispatch") >= 0) { methodName = buttonValue; break; } } return methodName.substring(0,methodName.indexOf('.')); } }
}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]