O. Oke wrote the following on 9/23/2004 5:47 PM:
Background ========== I have a class that extends the new MappingDispatchAction class . This class has two methods, namely getCustomer and updateCustomer.
The corresponding mapping for each method are below:
<action path="/getCustomer"
type="com.fujimitsu.cargo.gen.CustomerAction"
name="cargoForm" scope="request" validate="false" input=".customerDef.jsp"
parameter="getCustomer">
<forward name="success" path=".customerDef.jsp" />
</action>
<action path="/updateCustomer"
type="com.fujimitsu.cargo.gen.CustomerAction"
name="cargoForm" scope="request" validate="true" input=".customerDef.jsp" parameter="updateCustomer">
<forward name="success" path=".customerDef.jsp" />
</action>
my jsp has three buttons, namelygetCustomer, updateCustomer and cancel.
You sure you have a form that has a "get customer" and an "update customer" on the same page? That doesn't make too much sense. You sure "get customer" doesn't just take you to another page where you choose a customer to get? It sounds like you don't need to have a form to do what you want but probably just want a button that goes to a url mapped to your action. If they truly are buttons on a form then....
MappingDispatchAction is horrible for this. You end up having to swap out your action name with javascript which I don't like. Use any of the other dispatch flavors instead of MappingDispatch action for multiple buttons. Michael's SimpleDispatchAction handles this well or simply use a regular DispatchAction and change the dispatch parameter name with javascript. If you can't use javascript then use the SimpleDispatchAction over LookupDispatch action. I don't like the LookupDispatchAction at all. For a dispatch action you could do something similar to:
<html:hidden property="dispatch">
<html:submit onclick="myForm.dispatch.value='update'">Update</html:submit>
<html:submit onclick="myForm.dispatch.value='get'">Get Customer</html:submit>
Michael's SimpleDispatchAction is much cleaner though for multiple buttons on a page. You should give it a try.
-- Rick
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]