Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Help coderanch get a
new server
by contributing to the
fundraiser
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
Struts
Multiple Submit Buttons?
Bloo Barton
Ranch Hand
Posts: 63
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I would like to submit a form that has multiple submit buttons. For each button I would like to send a different action.
How can I dynamically populate the action parameter to my form when doing this?
<html:form action="???">
<%-- Submit Buttons --%>
<html:submit property="Confirm"><fmt:message key="label.confirm"/></html:submit>
<html:submit property="Re-enter"><fmt:message key="label.reenter"/></html:submit>
<html:submit property="Logout"><fmt:message key="label.logout"/></html:submit>
<%-- Etc... --%>
</html:form>
Srilakshmi Vara
Ranch Hand
Posts: 169
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
You can do this in two ways... One by writing different actions to the buttons and calling them onclick or write the different actions as different method in a single DispatchAction class and calling different method on different button clicks.
Bloo Barton
Ranch Hand
Posts: 63
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How would I do the first method?
Srilakshmi Vara
Ranch Hand
Posts: 169
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Write to action classes and two action mappings in struts-config file with the same actionform.
In the
jsp
add the below javascript on onClick event
function formAction() {
document.form.action="aaa.do"
document.form.submit();
}
Srilakshmi
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
intermediate submit and validation of a form
textbox - onBlur, fire off a Struts action
LookupDispatchAction
how to make the form set focus on the submit button by default.
difference between DispatchAction and LookupDispatchAction.
More...