This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "example for ImageButtonBean using DispatchAction class" Watch "example for ImageButtonBean using DispatchAction class" New topic

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.

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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: example for ImageButtonBean using DispatchAction class
It's not a secret anymore!