Hi, this is a big question, so probably for only the patient ones...
All the solutions with the image tag are based on transforming the parameter name in the tag to a value. The name\value pair, e.g. button.submit.x=9, is useful only for the name, i.e. for "button.submit.x" and not for the value, i.e. "9". This is, of course, unusual. So, solutions must efficiently determine whether the name was this or that and have no interest at all in the value in this case. I like, after much experimentation, just doing it as follows:
public final class ButtonCommand { private ButtonCommand() { }
public final static String getCommand(HttpServletRequest request) { Enumeration enum = request.getParameterNames(); String parameterName = null; while(enum.hasMoreElements()) { parameterName = (String)enum.nextElement(); if(parameterName.endsWith(".x")) { return parameterName.substring(0,parameterName.indexOf('.')); } } return parameterName; } }
This works when the name attribute in <input type='image' name='whatever> (the property attribute in <html:image>) is whatever you want as the "command". (The word "command" is probably a misnomer here.) So, if you have <html:image property='submit'> etc., this will be sent as something like submit.x=7&submit.y=11. You can use the presence of the ".x" to mine the value of the name or property attribute directly wherever you do your controller logic.
There are two solutions at: http://wiki.apache.org/struts/StrutsCatalogMultipleImageButtonsWithNoJavaScript. The one is very simple and probably is the best. Ted Husted's solution, I have come to think, after having done something similar, is just to heavy. There is no need to create all those button objects. However, if you read the above link and in particular the least favored solution using CrackWillowButton as an inner class for ActionForms, you will see how Ted's works, I think, since the ideas are similar.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]