struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierce, Britt" <>
Subject RE: struts-user Digest 22 Feb 2002 17:34:22 -0000 Issue 1164
Date Fri, 22 Feb 2002 19:13:38 GMT

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

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;
        		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:   <>
For additional commands, e-mail: <>

View raw message