Hi too,
I've not found the need to employ any clever Javascript to deal with this situation...

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

You can use the same functions to retrieve the value of form fields to check which 
button is pressed.

ie.
        req.getParameter("btn_1") will return "First button" if the
        first button is pressed and null if the second button is pressed
likewise
        req.getParameter("btn_2") will return "Second button" if the
        second button is pressed and null if the first button is pressed

Alternatively you could give both buttons the same name as in this example...
<form action="/servlet/..." method="...get or post"/>
<input type="SUBMIT" NAME="submitButton" VALUE="First button">
<input type="SUBMIT" NAME="submitButton" VALUE="Second button">
</form>

        req.getParameter("submitButton") will return "First button" if the
        first button is pressed and "Second button" if the second
        button is pressed

I haven't tested this widely in different browsers and servlet engines. My guess, 
though, is that this is more portable than javascript setting the value of a hidden 
field (something I have had problems with in the past).

kev


EOM

NOTICE - This message contains information intended only for the use of the addressee 
named above.  It may also be confidential and/or privileged.  If you are not the 
intended recipient of this message you are hereby notified that you must not 
disseminate, copy or take any action in reliance on it.  If you have received this 
message in error please notify [EMAIL PROTECTED]

___________________________________________________________________________
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