At 2:26 PM -0500 1/20/04, [EMAIL PROTECTED] wrote:
Hi i am trying to capture a value through the <html:image> tag. There is a
"value" attribute also in this tag. But i am not sure what would be the
paramter name of this value.
I am using something like this

<html:image value="Step 1"> i need to capture the value "step 1" I cannot
see this value being passed on the URL.

Let me know if any one has any inputs.

A browser submits values for an "input type='image'" element by setting two request parameters, /name/.x and /name/.y where /name/ is the value of the 'name' attribute of the input element, and the values are the x and y coordinates of the click in the image. For "input type='image" elements in the form which are not submitted, no parameters are set. In Struts, the value of the "property" attribute of the html:image tag is used as the "name" of the input field.


In practice, it seems that few people use the coordinates of the click, and instead just look for a request parameter with the "telltale" name and build logic from that.

From a Struts perspective, if you want to get the values in a Form, you'll have to make the appropriate property of your form a bean with properties named "x" and "y" (that is, setX(Integer), setY(Integer) and corresponding accessors), because you can't stop the automated bean population process from interpreting the "." in the request parameter name as a separator between chained property names. If you did this, then you could add another method which returned 'true' if either of those values were non-null.

Or you could add a javascript handler to the image input element which sets a hidden field explicitly to the value you want before submitting the form, and then check the value of that parameter instead..

Or you can just access the request parameters directly in your action, which might be easiest.

Joe

PS some of this is discussed in the doc for html:image:
http://jakarta.apache.org/struts/userGuide/struts-html.html#image

--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining."
-- Jef Raskin


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



Reply via email to