We are using the <struts-html:image> tag to produce graphical buttons. This tag writes 
a HTML tag <input type="image" name="aaa">.

the problem with the <input type="image"> tag is that it submits "aaa.x" and "aaa.y" 
parameters rather than the usual "aaa" parameter.

Thus I cannot use the <struts-html:image> for a cancel function because the
ActionServlet tests for Constants.CANCEL_PROPERTY, in a request that include only 
Constants.CANCEL_PROPERTY.x  and Constants.CANCEL_PROPERTY.y parameters.

So I have subclassed the ActionServlet and Action classes as below

ActionServlet (row 1851)
 if (request.getParameter(Constants.CANCEL_PROPERTY) != null) {
        ...
MYActionServlet:
 if (request.getParameter(Constants.CANCEL_PROPERTY) != null
    ||
    request.getParameter(Constants.CANCEL_PROPERTY+".x") != null) {
         ...

Action (row 457)
    protected boolean isCancelled(HttpServletRequest request) {
        return (request.getParameter(Constants.CANCEL_PROPERTY) != null);

MYAction
    protected boolean isCancelled(HttpServletRequest request) {
        if (super.isCancelled(request))
            return true;
            return 
(request.getParameter(org.apache.struts.taglib.html.Constants.CANCEL_PROPERTY+".x") != 
null);
    }

Isn't there a better way to handle this problem ?
anybody else using <struts-html:image tag> to handle cancel ?

Christophe

Reply via email to