This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes example for ImageButtonBean using DispatchAction 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 "example for ImageButtonBean using DispatchAction class" Watch "example for ImageButtonBean using DispatchAction class" New topic
Author

example for ImageButtonBean using DispatchAction class

sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
Hi Ranchers,

I want an example where a Jsp page has multiple image buttons and each button calling the same dispatchAction.

i am able to do call dispatchAction class in the follwing manner in the jsp page..
----------------------------
<html:hidden property="go" value="error"/>
<SCRIPT>function set(target) {document.forms[0].go.value=target;}</SCRIPT>
<html:submit onKlick="set('save');">SAVE</html:submit>
<html:submit onKlick="set('create');">SAVE AS NEW</html:submit>
<html:submit onKlick="set('delete);">DELETE</html:submit>

--------------------------
what i want is ,I want use ImageButton Bean class to call appropriate method in DispatchAction class.


Thanks
Sreenivas
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'm afraid the ImageButtonBean doesn't really fit the pattern needed by DispatchAction very well. With the ImageButtonBean, you need a separate property for each button, while Dispatch action was made to work with a single property having multiple values.

Since you've already got working code using JavaScript, my suggestion would be just to keep the same pattern and use the onclick event of the html:image tag to set the value of the governing property for your DispatchAction.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: example for ImageButtonBean using DispatchAction class
 
Similar Threads
how can i map different Actionform class to single Action class
MappingDispatchAction's JSP CODE
Delete Confirmation window
Struts:: referring indexId of logic:iterate from javascript call
DispatchAction error .... NoClassDefFoundError...