Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Struts DispatchAction

843838Sep 5 2005 — edited Sep 5 2005
Hey, I need to create a form with multiple submit buttons, but I want to deal with them all in a single action class.I think if I use a dispatchAction, and specify 'method' as the parameter attribute for the action in the struts-config, and I use the following code:

<html:submit property="method" value="Start" />
<html:submit property="method" value="Stop" />
<html:submit property="method" value="Reset" />

it will call the Start(), Stop(), and Reset() methods repectively. Problem is, some of my submit buttons need values with spaces in them, like "Add Data"...I'm wandering how I can get it to call an appropriate method in this case. I thought about using a hidden field instead for the action parameter - which I will embed within each submit field...ie.:

<html:submit value="Add Data">
<html:hidden property="method" value="addData" />
</html:submit>
<html:submit value="Start">
<html:hidden property="method" value="start" />
</html:submit>

Would this submit the appropriate value for the hidden field depending on the submit button pressed? I'd rather do this than use javascript to set a single hidden field....
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 3 2005
Added on Sep 5 2005
1 comment
188 views