You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Pierce, Britt" <br...@pioneer.com> on 2002/02/22 20:13:38 UTC

RE: struts-user Digest 22 Feb 2002 17:34:22 -0000 Issue 1164

I have to admit that I have not read all of the messages in this thread, so
I apologies if I am repeating anything...

But, I found in the archives that you can check to see if an image button is
clicked you can do it on the server side by looking for the .x or .y
property.  

So, for example, to check to see if an image button with property="cancel"
was clicked, you would do this in the action class:

	Enumeration attr = request.getParameterNames();
	String att;
	while(attr.hasMoreElements()){
        		att = ( String )attr.nextElement();
        		if ( att.equals( "cancel.x" )) {  
	       		return (mapping.findForward( "canceled" ));

	    }
You could then use this in your JSP to display your image button:
	<html:image src="images/cancel.gif" property="cancel".

The problem with image buttons is the browser does not return the 'value' of
the button, unlike a submit button.  Instead, an image button returns the
x/y position of the mouse click.  The above code will table up all of the
properties and check to see if the "x' property of "cancel" was created.  If
it exists, the button was clicked.  Again, unlike submit buttons, you can
NOT check the "value" because the browser never passes it.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>