You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Michael McGrady <mi...@michaelmcgrady.com> on 2004/08/10 18:16:31 UTC
Re: this.that.x=4 and this.that.y=9 translations
in ActionForm
At 08:53 AM 8/10/2004, you wrote:
>Have you tried this with the latest nightly build - I was having similar
>problems with some of the standard parameters struts uses (e.g. Cancel
>button indicator and Transaction tokens) - my forms were trying to get the
>"org" bean.
>
>I changed the form population mechanims to ignore parameters that start
>"org.apache.struts." recently to resolve this - try it with the nightly
>build.
>
>Niall
This is good news, Niall. I have a thought. I don't think anyone in
Struts has a use for the x and y values we get from html images. The real
use is for the parameter name and not the parameter value. Presently we
use fancy work arounds to deal with the fact that the names are read as
follows, e.g. for <input type='image' name='button.submit'>:
[form].getButton().getSubmit().setX(Integer x);
What would work better would be something where "name='submit'" in an html
image tag would be rendered as [form].setButtonCommand("submit"). This
would be easy to do by seeing what parameter name ended with .x and with
.y. Then, anyone that wanted to get whatever command could do so without
the workarounds like I use in
http://wiki.apache.org/struts/StrutsCatalogMultipleImageButtonsWithNoJavaScript.
What do you think? Where could this be attacked?
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: this.that.x=4 and this.that.y=9 translations
in ActionForm
Posted by Michael McGrady <mi...@michaelmcgrady.com>.
At 08:43 PM 8/10/2004, you wrote:
>Michael,
>
>Sorry its not something thats an issue for me at the moment and so its not
>high on my priorities to spend time giving some thought to.
>
>Niall
Niall,
I have come to think that this is not important enough to do, since I have
found the following simple solution, which I am sure can be improved with time:
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;
}
}
I can just pop this into the model where needed and call it a day.
Michael
Re: this.that.x=4 and this.that.y=9 translations in ActionForm
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Michael,
Sorry its not something thats an issue for me at the moment and so its not
high on my priorities to spend time giving some thought to.
Niall
----- Original Message -----
From: "Michael McGrady" <mi...@michaelmcgrady.com>
To: "Struts Developers List" <de...@struts.apache.org>
Sent: Tuesday, August 10, 2004 5:16 PM
Subject: Re: <html:image> this.that.x=4 and this.that.y=9 translations in
ActionForm
> At 08:53 AM 8/10/2004, you wrote:
> >Have you tried this with the latest nightly build - I was having similar
> >problems with some of the standard parameters struts uses (e.g. Cancel
> >button indicator and Transaction tokens) - my forms were trying to get
the
> >"org" bean.
> >
> >I changed the form population mechanims to ignore parameters that start
> >"org.apache.struts." recently to resolve this - try it with the nightly
> >build.
> >
> >Niall
>
>
> This is good news, Niall. I have a thought. I don't think anyone in
> Struts has a use for the x and y values we get from html images. The real
> use is for the parameter name and not the parameter value. Presently we
> use fancy work arounds to deal with the fact that the names are read as
> follows, e.g. for <input type='image' name='button.submit'>:
>
> [form].getButton().getSubmit().setX(Integer x);
>
> What would work better would be something where "name='submit'" in an html
> image tag would be rendered as [form].setButtonCommand("submit"). This
> would be easy to do by seeing what parameter name ended with .x and with
> .y. Then, anyone that wanted to get whatever command could do so without
> the workarounds like I use in
>
http://wiki.apache.org/struts/StrutsCatalogMultipleImageButtonsWithNoJavaScript.
>
> What do you think? Where could this be attacked?
>
> Michael
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org