Please help!

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.

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

    <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> 



My question:
============
1.  In my JSP, what what should be the value of the
ACTION attribute of html:form
   i.e. <html:form action="??????????">  (i.e. which
mapping should be specified here)?

2.  what should the code of the button for excuting
 a. getCustomer and updateCustomer method be?
    i.e. <html:submit ???????????????

  b.  cancel be i.e. <html:cancel ???????????????

Thank you.





> 
> 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
> 
Rick,

Thanks for your response, in order to shed more light
on what I am trying to do, I have added the relevant
part of my current JSP code above.  The JSP code above
works with DispatchAction.  However, due to the
limitations of DispatchAction, I want to use the new
MappingDispatchAction class.  As I stated, my question
are:
1.  In my JSP, what what should be the value of the
ACTION attribute of html:form
   i.e. <html:form action="??????????">  (i.e. which
mapping should be specified here)?

2.  what should the code of the button for excuting
 a. getCustomer and updateCustomer method be?
    i.e. <html:submit ???????????????

  b.  cancel be i.e. <html:cancel ???????????????


These are the parts of the jigsaw that I am missing.  

Thank you.

Ola.



        
        
                
___________________________________________________________ALL-NEW Yahoo! Messenger - 
all new features - even more fun!  http://uk.messenger.yahoo.com

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

Reply via email to