Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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?