Give multiple buttons the same name, but different values.
Your servlet then only has to look for the one parm, and use different values to
decide what to do:

<form action=/servlet/.....>
<input type="SUBMIT" NAME="BUTTON" VALUE="First">
<input type="SUBMIT" NAME="BUTTON" VALUE="Second">
</form>


in your program:

String buttonValue = req.getParameter("BUTTON"):
if (buttonValue.equals("First"))
     {
          // do button1 stuff
     }
else if (buttonValue.equals("Second"))
     {
     // do button 2 stuff
     }






Jose Miguel Rodriguez <[EMAIL PROTECTED]> on 03/06/2000 11:36:26 AM

Please respond to "A mailing list for discussion about Sun Microsystem's Java
      Servlet API Technology." <[EMAIL PROTECTED]>



To:   [EMAIL PROTECTED]
cc:    (bcc: Gary D. Schechter/CHASE)
Subject:  How to know which form button was pressed?



Hello all,

I'm developing a mini applications server for internal purposes, and now I'm
facing with a problem: suppose I have the following html code:

<form action=/servlet/.....>
<input type="SUBMIT" NAME="btn_1" VALUE="First button">
<input type="SUBMIT" NAME="btn_2" VALUE="Second button">
</form>

How do I know when user press the 1st or the 2nd button?

Thanks in advanced


--

 saludos,
 jmiguel

 Virtual Software,
 http://www.virtualsw.es/
 ICQ 13550064

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to