You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/02/16 17:23:34 UTC

DO NOT REPLY [Bug 17109] New: - Newbie FAQ - Can I have multiple submit buttons on the same form?

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17109>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17109

Newbie FAQ - Can I have multiple submit buttons on the same form? 

           Summary: Newbie FAQ - Can I have multiple submit buttons on the
                    same form?
           Product: Struts
           Version: Unknown
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Documentation
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: edgar@blue-moose.net


<p><strong>Yes</strong>.  The issue is that only one action class can be 
associated with a single form.</p>

So the real issue is how do I decode multiple submit types to a single 
<code>Action</code> class.
There is more than one way to achieve this functionality.

<p>The way that is suggested by struts is right out of the javadoc for <a 
href="http://jakarta.apache.org/struts/api/org/apache/struts/actions/LookupDispa
tchAction.html"><code>LookupDispatchAction</code></a>.
Basically, <code>LookupDispatchAction</code> is using the keys from 
<code>ApplicationProperties.resources</code> as keys to a map of actions 
available
to your <code>Action</code> class.  It uses <a 
href="http://java.sun.com/j2se/1.3/docs/guide/reflection/">reflection</a> to 
decode the request and invoke the proper action.  It also takes advantage of 
the struts <a href="http://jakarta.apache.org/struts/userGuide/struts-
html.html#submit"><code>&lt;html:submit&gt;</code></a> tags and
is straight forward to implement.

<p>You can roll your own with javascript events and <code>javascript:void
(document.forms["myform"].submit)</code> on any html element.  This gives you 
control of how you want your page to look.  Again you
will have to decode the expected action in the <code>execute</code> method of 
your action form if you choose this route.</p>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org