The way i have done it is to pass a parameter to the same action. The
parameter value changes based on what button was clicked before the form is
submitted.
It is impossible to have 2 methods with the same signature to be invoked. 

-----Original Message-----
From: struts lover [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 15, 2004 9:55 AM
To: Struts Users Mailing List
Subject: Re: Multiple button with same value using same Action class


It is not possible with lookupdispatchaction class.
You need to have different method signatures. You have
to have different names for your cancel button like
Cancel Sign, Cancel Reservation etc.


--- Michael McGrady <[EMAIL PROTECTED]> wrote:

> What you describe sounds impossible.  How do you
> have multiple methods 
> with the same signature in one Action class?
> 
> Michael
> 
> Sebastian Ho wrote:
> 
> >Hi
> >
> >I have been using LookupDispatchActin for a while
> and everything works
> >fine until..
> >
> >I reuse the same Action class for a couple of JSPs.
> Some of the JSP has
> >the button Cancel in them. Because they are in
> different JSP, the
> >forwarded JSP will be different when Cancel is
> selected.
> >
> >In the getKeyMethodMap() method, I have a few keys
> which maps to
> >'Cancel' in my applicationresources.properties. And
> each of them will
> >map to a different method. 
> >
> >Problem is they are using the same 'Cancel' value
> with parameter
> >'action'. Because of the way LookupDispatchAction
> works, the first key
> >that map will be used and the corresponding method
> called. 
> >
> >Can I make it maps to different methods?
> >
> >How do I resolve this? I am using Struts 1.1.
> >
> >--------------------------------
> >To illustrate
> >--------------------------------
> >In X.jsp :
> >
> ><html:cancel property="action" value="Cancel">
> >      <bean:message
> key="button.cancelforgotpassword"/>
> >    </html:cancel>
> >
> >
> >In Y.jsp :
> >
> ><html:cancel property="action" value="Cancel">
> >      <bean:message key="button.cancelsign"/>
> >    </html:cancel>
> >
> >In properties :
> >
> >button.cancelforgotpassword = Cancel
> >button.cancelsignup = Cancel
> >
> >
> >In Action :
> >
> >protected Map getKeyMethodMap() 
> > {
> >  Map map = new HashMap();
> > map.put("button.cancelsignup", "cancelSignup");
> > map.put("button.cancelforgotpassword",
> "cancelForgotPassword");
> > return map;
> > }
> >
> >
> >Thanks
> >
> >Sebastian Ho
> >
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
> >
> >
> >  
> >
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

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

Reply via email to