public String
getPos0()
{
index = 0;
return "";
}
public String
getPos1()
{
index = 1;
return "";
}
public String getPos2()
{
index = 2;
return "";
}
// give the index of the button back
public int getIndex()
{
return index;
}
I can
find out witch button was pressed by calling
getIndex().
Will I run in struts-specific-Problems sooner or later as it is not really logic, that the get-Method is called ? (I already know that the methods don't look nice...)
Thanks for your help
Beat Friedli
------------------------------------------------------------------------------
-----Ursprüngliche Nachricht-----
Von: CARDON Denis [mailto:[EMAIL PROTECTED]]
Gesendet: Freitag, 21. September 2001 15:11
An: '[EMAIL PROTECTED]'
Betreff: RE: html:image does not call the setter-method of the formHi Beat,
When you post a form by clicking on a <input type="image" name="my_button_name" value="value"/> button, you only receive the coordinates where the user clicked the button as:
my_button_name.x=###
my_button_name.y=###but the browser does not post the value contained in the value attribute :-( (previous mails already related this problem explaining that it is unfortunatly the correct behavior according to HTML specs :-(
So a trick would be to put both the name and the value of the button in the name attribute, like this:<input type="image" name="editPos_position0" src="..."/>
<input type="image" name="editPos_position1" src="..."/>then you can retrieve the name/value pair by scanning all the parameters contained in the request and looking for something starting with "editPos_". Then you have to strip "editPos_" and the ".x" or ".y" to get the value. (this seems also to be the way used by amazon, in the attribute name="submit.edit-gift.1", "submit" would be the name, "edit-gift.1" would be the value).
I am not still very clear how to integrate this nicely with ActionForm.
Regards,
Denis
-----Original Message-----
From: Friedli Beat [UFA AG Her] [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 21, 2001 1:57 PM
To: '[EMAIL PROTECTED]'
Subject: AW: html:image does not call the setter-method of the form
Hi
Does this mean, if I want to use image-buttons instead of submit-Buttons I would have to put each one in a seperate form?Hm, I had a look at the shop from Amazone. The use image-buttons as well, but each one has a different name like this:
name=submit.edit-gift.1
name=submit.edit-gift.2
name=submit.edit-gift.3
What is the trick they are doing? (All the image-buttons are in the same form)
Thanks for your Helb
Beat Friedli
---
I believe that the HTML specification says that for an input of type image
the value is not submitted to the server, instead the x- and y-coordinate of
the click is submitted. The name of these parameters is name.x and name.y,
where name is the name attribute of the element.
I don't think the tag-lib of struts is meant to do any trick to also send
the value parameter
--
Jan Sorensen
aragost
I believe that for the generated code the value is not submitted in the
request
>In a jsp Form this code works works perfect:
><html:submit property="editPos" > Position<%= val %> </html:submit>
>
>Now I decided to use an image instead of a button like this:
><html:image property="editPos" src="graphics/editWarenkorb.gif"
>value="Position<%= val %>" />
>
>The generated Code looks fine to me:
><input type="image" name="editPos"
>src="graphics/editWarenkorb.gif;jsessionid=F3C57101544373C1913436E0277103C7
" >value="Position0">
>
>But the value 'Position0' is never filled up in the Formbean as the
setter->method never is called. And I know, that the Formbean and all works
correct >as it works fine withe the submit-Button. Is my html:image Tag not
good?
>
>Thanks for any help or idea
>
>Beat Friedli