Yuri, I was successfully able to do this.  Here is an example of the code
I'm using...

Hope this helps!!

--John

On the JSP:

 <html:submit property="action">
   <bean:message key="button.companySearch"/>
 </html:submit>

 <html:submit property="action">
   <bean:message key="button.removeChecked"/>
 </html:submit>

<html:submit property="action">
   <bean:message key="button.queue"/>
 </html:submit>



In form bean (ActionForm):
You need a property, this example uses 'action'.

    private String action;

    public String getAction() {
        return this.action;
    }
    public void setAction(String action) {
        this.action = action;
    }


In Action's perform():
  OrderSearchForm formbean = (OrderSearchForm)form;
  // Tell us what button was pressed.
  String action = formbean.getAction();






-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 21, 2001 3:16 PM
To: [EMAIL PROTECTED]
Subject: Re: Multiple Submit Buttons


David,

Yes, it's possible, but unfortunately Struts won't help
you much in this case like it does with "cancel" or
single "submit" buttons. (please correct me, if I'm wrong)
Perform method of Action takes HttpServletRequest object as request and
you can execute its getParameter() method to find out which
button was pushed.

Best of luck,
Yuriy Zubarev


--- DHarty <[EMAIL PROTECTED]> wrote at 21 Jun 08:43 :

> Is it possible to use multiple <html:submit/> buttons in the same form,
and>
> provide a different action depending on which was hit?>
>
>       ex:>
>
>       <html:submit>Do something</html:submit>>
>       <html:submit>Do Something Else</html:submit>>
>       <html:submit>Do Yet Another Thing</html:submit>>
>
> I know you can check if the button is a cancel, but that only works if
you>
> have two alternatives.>
>
> I'm looking for a way in the Action class to see which button was hit.>
>
> Thnxs>
> David>

Reply via email to