You would do it the way you'd do it an any web application.

Here's how I do it:  All my button field names start with "btn".  I would 
name these buttons btnProcess, btnViewByOrg and btnViewByProcess (or 
something similar).

In my perform method, I'd put code like this:

   String button_pressed = null;
   Enumeration e = request.getParameterNames();
   while ( e.hasMoreElements() ) {
      String param = (String)e.nextElement();
      if ( param.startsWith("btn") ) {
         button_pressed = param;
         break;
      }
   }

At this point, button_pressed tells you the name of the button that was 
pressed.  I have a utility class that has this code in it and I use it 
everywhere.

Jay

On Wed, 13 Feb 2002, Mattos, John wrote:

> Hi.
> 
> I have a form that can be submitted by three different buttons, for example
> the buttons read
> 
> (Button Labels)
> Process
> View by Org
> View by Product
> 
> What I want to do is in the Action Class handling the submission, find out
> which button was pressed, and act accordingly, whether it's an actionForward
> (in the case of the "view" options) or kicking off another process (as will
> be done by the "process" button)
> 
> So, how can I figure out what button was pressed in that Action class? Is
> there a way to do that?
> 
> John Mattos
> Sr. Developer and Architect
> iNDEMAND
> 345 Hudson St. 16th Floor
> New York, New York
> 10014
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


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

Reply via email to