Re: html:image and IE
The whole point is not to use the form, I think, Chad. By the way, all the browsers return the keys with .x and .y, even though some also return the variables without the .x and .y. On 5/9/05, Chad Rosen [EMAIL PROTECTED] wrote: Ok I'm going to reply to myself :) Adding this check solved the problem for IE.. request.getParameter(updateCart.x) != null However, I'd prefer to use the form. Is this the preferred way? form-property name=updateCart type=java.lang.String/ Will this catch both the IE and Firefox submissions? Or should I do this? form-property name=updateCart.x type=java.lang.String/ form-property name=updateCart.y type=java.lang.String/ From: Chad Rosen [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: user@struts.apache.org Subject: html:image and IE Date: Mon, 09 May 2005 19:20:47 -0400 Hi all.. I have a shopping cart page with two submit buttons that we've changed to html:image tags. They look like this.. html:image property=checkout value=Check Out src=/cerebus/store/images/checkout.gif/ and html:image property=updateCart value=Update src=/cerebus/store/images/updateCart.gif/ In my action I'm checking to see if the user has pressed the updateCart image. If they did I return them back to the cart. if(request.getParameter(updateCart) != null) { //do stuff here. } So, this works in firefox/netscape but it doesn't in IE. I guess IE submits the value of the image as updateCart.x and updateCart.y (where x and y are the coordinates of the image that were pressed). What is the propper way to deal with this so that it works in both IE and Firefox. I'm defining my form beans in the struts-config as DynaValidatorActionForms so I can't do the solution in the struts user guide. Thanks, Chad - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:image and IE
form-property name=updateCart.x type=java.lang.String/ form-property name=updateCart.y type=java.lang.String/ From the docs: A way of retrieving these values through a form bean is to define getX(), getY(), setX(), and setY() methods, and specify your property as a blank string (property=). So, you could just do: form-property name=x type=java.lang.String/ form-property name=y type=java.lang.String/ In a JSP: html:image property= value=Update src=/cerebus/store/images/updateCart.gif/ Then in your action: if (((DynaBean)form).get(x).equals(Update) Probably better to use the request parameter though, and not go through the trouble of setting up the form properties. Honestly, I don't see what the image tag really adds beyond some module support via the page attribute. HTH, Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:image and IE
I may be wrong, Dave, but I think you are going to get an integer value for getX and getY and not Update. Isn't that right? That is why the solutions have to be a little more detailed and why we got saddled with the LookupDispatchAction and other heavy solutions. Once again, I think the options at www.michaelmcgrady.com/button are instructive, even if you want to do something different. On 5/11/05, Durham David R Jr Ctr 805 CSPTS/SCE [EMAIL PROTECTED] wrote: form-property name=updateCart.x type=java.lang.String/ form-property name=updateCart.y type=java.lang.String/ From the docs: A way of retrieving these values through a form bean is to define getX(), getY(), setX(), and setY() methods, and specify your property as a blank string (property=). So, you could just do: form-property name=x type=java.lang.String/ form-property name=y type=java.lang.String/ In a JSP: html:image property= value=Update src=/cerebus/store/images/updateCart.gif/ Then in your action: if (((DynaBean)form).get(x).equals(Update) Probably better to use the request parameter though, and not go through the trouble of setting up the form properties. Honestly, I don't see what the image tag really adds beyond some module support via the page attribute. HTH, Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:image and IE
Unless Dave is right, Chad,which I don't think he is, the difficulty is that you get as a name/value pair in the request parameters [property].x=[some integer] and [property].y=[some integer] so that the task becomes getting the name which is the property in [property] rather than the value, i.e. [some integer], in the name/value pair. This problem, however, once you solve it simply provides lots of benefits which can be transferred to other areas. Normally the getX() and getY() methods test for null or not null so that you can then detemine which property name was fired. That is what is done well in the suggested options on www.michaelmcgrady.com/button. 'Hope this is helpful. If Dave is right, then I have something else to learn. On 5/11/05, Dakota Jack [EMAIL PROTECTED] wrote: I may be wrong, Dave, but I think you are going to get an integer value for getX and getY and not Update. Isn't that right? That is why the solutions have to be a little more detailed and why we got saddled with the LookupDispatchAction and other heavy solutions. Once again, I think the options at www.michaelmcgrady.com/button are instructive, even if you want to do something different. On 5/11/05, Durham David R Jr Ctr 805 CSPTS/SCE [EMAIL PROTECTED] wrote: form-property name=updateCart.x type=java.lang.String/ form-property name=updateCart.y type=java.lang.String/ From the docs: A way of retrieving these values through a form bean is to define getX(), getY(), setX(), and setY() methods, and specify your property as a blank string (property=). So, you could just do: form-property name=x type=java.lang.String/ form-property name=y type=java.lang.String/ In a JSP: html:image property= value=Update src=/cerebus/store/images/updateCart.gif/ Then in your action: if (((DynaBean)form).get(x).equals(Update) Probably better to use the request parameter though, and not go through the trouble of setting up the form properties. Honestly, I don't see what the image tag really adds beyond some module support via the page attribute. HTH, Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:image and IE
David, could you please indicate which docs you are talking about and give a reference? Thanks. On 5/11/05, Durham David R Jr Ctr 805 CSPTS/SCE [EMAIL PROTECTED] wrote: form-property name=updateCart.x type=java.lang.String/ form-property name=updateCart.y type=java.lang.String/ From the docs: A way of retrieving these values through a form bean is to define getX(), getY(), setX(), and setY() methods, and specify your property as a blank string (property=). So, you could just do: form-property name=x type=java.lang.String/ form-property name=y type=java.lang.String/ In a JSP: html:image property= value=Update src=/cerebus/store/images/updateCart.gif/ Then in your action: if (((DynaBean)form).get(x).equals(Update) Probably better to use the request parameter though, and not go through the trouble of setting up the form properties. Honestly, I don't see what the image tag really adds beyond some module support via the page attribute. HTH, Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:image and IE
Ok I'm going to reply to myself :) Adding this check solved the problem for IE.. request.getParameter(updateCart.x) != null However, I'd prefer to use the form. Is this the preferred way? form-property name=updateCart type=java.lang.String/ Will this catch both the IE and Firefox submissions? Or should I do this? form-property name=updateCart.x type=java.lang.String/ form-property name=updateCart.y type=java.lang.String/ From: Chad Rosen [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: user@struts.apache.org Subject: html:image and IE Date: Mon, 09 May 2005 19:20:47 -0400 Hi all.. I have a shopping cart page with two submit buttons that we've changed to html:image tags. They look like this.. html:image property=checkout value=Check Out src=/cerebus/store/images/checkout.gif/ and html:image property=updateCart value=Update src=/cerebus/store/images/updateCart.gif/ In my action I'm checking to see if the user has pressed the updateCart image. If they did I return them back to the cart. if(request.getParameter(updateCart) != null) { //do stuff here. } So, this works in firefox/netscape but it doesn't in IE. I guess IE submits the value of the image as updateCart.x and updateCart.y (where x and y are the coordinates of the image that were pressed). What is the propper way to deal with this so that it works in both IE and Firefox. I'm defining my form beans in the struts-config as DynaValidatorActionForms so I can't do the solution in the struts user guide. Thanks, Chad - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:image and IE
The IE behavior you discuss is the normal behavior. That is the trick with multiple submits and input type='image'. For various solutions you can see LookupDispatchAction in Struts (which is really heavy) or a bevy of choices at www.michaelmcgrady.com/button/ Peace On 5/9/05, Chad Rosen [EMAIL PROTECTED] wrote: Hi all.. I have a shopping cart page with two submit buttons that we've changed to html:image tags. They look like this.. html:image property=checkout value=Check Out src=/cerebus/store/images/checkout.gif/ and html:image property=updateCart value=Update src=/cerebus/store/images/updateCart.gif/ In my action I'm checking to see if the user has pressed the updateCart image. If they did I return them back to the cart. if(request.getParameter(updateCart) != null) { //do stuff here. } So, this works in firefox/netscape but it doesn't in IE. I guess IE submits the value of the image as updateCart.x and updateCart.y (where x and y are the coordinates of the image that were pressed). What is the propper way to deal with this so that it works in both IE and Firefox. I'm defining my form beans in the struts-config as DynaValidatorActionForms so I can't do the solution in the struts user guide. Thanks, Chad - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]