struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakota Jack <>
Subject Re: Workaround for IE not sending "value" on input image tag?
Date Tue, 21 Dec 2004 16:34:50 GMT
Hello, David,

You might as well forget about the wonders of firefox and learn to
live for the moment with browsers that merely give you coordinates. 
Struts has many solutions to this problem which are in the code, such
as LookupDispatchAction, ImageButtonBean (or something like that) and
so on.  All these solutions are built around, in the end, determining
what the value of the image tag submit button is.  They are all dated
and not what you need, I think.  I use a number of solutions which are
take-offs on the varieties shown at . 
If you are interested in these more esoteric answers, I would be happy
to send them to you.  For the moment, something like the following
works well:

import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;

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.indexOf(".method") != -1) {
        command = buttonValue.substring(0,buttonValue.indexOf('.'));
    return command;

All you have to do in this case is change your code to <input
type="image" name="abc.method" src="/inputbug/images/delete.gif"> if
you want to get "abc" as the value of "command".  Usually image
buttons are used when you have multiple commands you might want to
use, such as "delete", "submit", "store", etc.  So, the code would
normally be something like:

<input type="image" name="delete.method"
src="/inputbug/images/delete.gif" value="abc">
<input type="image" name="save.method" src="/inputbug/images/save.gif">

The variable "command" would be "delete" in the former case and "save"
in the latter.  If you really want the value of "value", which you
probably don't, then you can use request.getParameter(command + ".x").


"You can lead a horse to water but you cannot make it float on its back."

~Dakota Jack~

"You can't wake a person who is pretending to be asleep."

~Native Proverb~

"Each man is good in His sight. It is not necessary for eagles to be crows."

~Hunkesni (Sitting Bull), Hunkpapa Sioux~


"This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation."

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message