O. Oke wrote the following on 9/24/2004 6:22 AM:

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.

JSP CODE
========
The works with DispatchAction.  However, due to the
limitations of DispatchAction, I want to use the new
MappingDispatchAction class.

What are these limitations? For what you are trying to do the limitations are actually the other way around:)



<html:form action="/Customer">
<%-- onsubmit="return validateCargoForm(this);"--%>
<table width="500" border="0">
................
................
other fields....
................
................ <html:hidden property="methodToExecute"
value="unknownMethod"/> <SCRIPT>function set(target)
{document.forms[0].methodToExecute.value=target;}</SCRIPT>
<html:submit onclick="bCancel=true;
set('getCustomers')">Get Customer</html:submit>
<html:submit onclick= "set('updateCustomer')">Update Customer</html:submit>
<html:cancel/>
</html:form>


Your trying to use a MappingDispatchAction like a DispatchAction don't do this. Just use DispatchAction. So you make one Action "CustomerAction" and you can have one mapping <action path="/customerAction" ..>
and then you have the different dispatch methods inside. Simple.


If you want to use MappingDispatchAction then you'll have to use javascript to change the action name in your <html:form action="" section. I find that uglier than setting a dispatch parameter with javascript.

I guess you didn't look at the SimpleDispatchAction either?


-- Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to