You can use Dispatch Action.
IXT_5_720IXT_5_719The purpose of the IXT_5_722IXT_5_721DispatchAction class
is to allow multiple operations that normally would be scattered throughout
multiple Action classes to reside in a single class. The idea is that there
is related functionality for a service, and instead of being spread over
multiple Action classes, it should be kept together in the same class. For
eg, Add, delete,View etc.
To use the DispatchAction class, create a class that extends it and add a
method for every function you need to perform on the service. Your class
should not contain the typical execute( ) method, as other Action classes
do. The execute( ) method is implemented by the abstract DispatchAction
class. 
jakarta_IDXTERM_683jakarta_IDXTERM_682You must include one method in your
DispatchAction for every Action you want to invoke for this DispatchAction.
<http://%20/JVXSL.asp?x=1&mode=section&sortKey=hits&sortOrder=desc&view=book
&xmlid=0-596-00328-5/jakarta-CHP-5-SECT-1&open=true&title=Most%20Read%20Book
s&catid=&s=1&b=1&f=1&t=1&c=1&u=1#jakarta-CHP-5-EX-9jakarta-CHP-5-EX-9>
Example 5-9 will help illustrate this. 
 
In struts-config change it as follows for eg:

<action path="/cart"
  input="/order/shoppingcart.jsp"
  parameter="method"
  scope="request"
  type="com.oreilly.struts.storefront.order.ShoppingCartActions"   
  validate="false">
  <forward name="Success" path="/order/shoppingcart.jsp" redirect="true"/>
 </action>
 
And in the action of the form specify the value for the parameter method to
the correspoonding function you want to call in the DispatchAction.
Shobhana
 
 
ch05_idx_1000005925_1ch05_idx_1000005925_2-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, March 15, 2004 5:46 PM
To: [EMAIL PROTECTED]
Subject: Handling multiple submits from a single form


 
Hi
 
I have multiple actions possible from a single JSP page. How can I handle it
using struts? I have single form with multiple buttons and I am using the
html tag library. How can I handle it without using javascript?
 
Regards
Sajith

Reply via email to