permaculture playing cards*
The moose likes Struts and the fly likes how to tell which icon was clicked in the action class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to tell which icon was clicked in the action class?" Watch "how to tell which icon was clicked in the action class?" New topic
Author

how to tell which icon was clicked in the action class?

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi there,

To make the site more user friendly I decided to use icons (this is instead of buttons).My code looks like this:



Question, when the user clicks a button and that goes into the Action Class, how can I tell which icon was pressed? (Is there more than one option?)

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Use the <html:image> tag and specify a property name in the tag. Then create a property of the same name in your ActionForm of type ImageButtonBean. In the execute method of your Action class, call the isSelected() method on this bean. It will return true if the button was clicked, and false if it wasn't.
[ October 22, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to tell which icon was clicked in the action class?
 
Similar Threads
how to access the <param> in jsp which are set from struts.xml
complete web.xml sample
Redirects in Inceptor
Forwarding data struts.xml
Ajaxstart/Ajaxstop Global Handler Form Reference