Thanks for bringing this up.  I created a ticket and have fixed the
issue: http://issues.apache.org/struts/browse/WW-1532

The problem is complicated by the fact that IE doesn't submit the
button name in addition to the .x and .y.  All cases should be
properly handled now.

Don

On 11/28/06, Ing. Andrea Vettori <[EMAIL PROTECTED]> wrote:
Hi,

yesterday it took me a day to understand and resolve a problem so I
think it can be useful to share it; maybe someone can explain a
better solution.

I have a form with more than one submit button. The submit buttons
are images so I used the <s:submit type="image" method="...." ...>
tag on all but the "default" button.

The problem is that since the image button is considered by the
browser similar to an "imagemap", if the button is called btnA, the
browser submits btnA, btnA.x and btnA.y request parameters, where
the .x and .y are the coordinates of the click inside the image. I
think this cannot be disabled on the browser since it is required by
the HTML specifications.

Now this cause problems when the parameters are used by the action to
call the appropriate method. If I have a button like

<s:form action="anAction" ...>
<s:submit type="image" method="aMethod" ...>

in the HTML you get something like

<input type="image" name="method:aMethod" ...>

and when the request is submitted the browser sends method:aMethod,
method:aMethod.x and method:aMethod.y parameters. This cause the
framework to try to execute the aMethod.x() method on the action
class which generate an Exception !!!

I've tried to filter the parameters with ParameterNameAware but the
parameter that starts with method: are not passed to the
acceptableParameter method. So I extended the parameters interceptor
and overrided the acceptableParameter function and even if now I see
the parameters on the method, even if I reject them, the framework
use them to try to execute the method in the action.

The solution I used is to have the image submit to set a value (like
<s:submit type="image" name="aName" value="aValue" > and use that
value inside the execute method of the action to call the appropriate
method.

But I'm looking for a better solution. I also think that since this
will be a common problem, it should be addressed by the framework
automatically rejecting method:xxx and action:xxx parameters that
ends with a ".x" and ".y".

Thanks

--
Ing. Andrea Vettori
Consulente per l'Information Technology






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to