You are mixing client side JavaScript with server side Java.
It will not work!!!
Instead set the value to the parameter that you want to see and use in the servlet!
<SELECT Name="Users" Size="9" onChange=showValue()>
<OPTION value="Barbara"> Barbara Parker
<OPTION value="Glen">Glenn Angell
..
</SELECT>
Simple get the parameter "Users" as you named the HTML Select element.
try {
userId = request.getParameter("Users");
}
catch(Exception e) {
e.printStackTrace();
}
It will work then
--
Peter Pilgrim
G.O.A.T
"The Greatest of All Time"
---------------------------------------- Message History
----------------------------------------
From: Amar Das <[EMAIL PROTECTED]>@java.sun.com> on 16/11/2000 11:12 EST
Please respond to "A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology." <[EMAIL PROTECTED]>
DELEGATED - Sent by: "A mailing list for discussion about Sun Microsystem's Java
Servlet API Technology."@java.sun.com>
To: [EMAIL PROTECTED]
cc:
Subject: Reading option value from select
Hi all,
I have a form the submit buttons calls a servet. The form has a select
box like the following.
<SELECT Name="Users" Size="9" onChange=showValue()>
<OPTION value=5>Barbara Parker
<OPTION value=1>Glenn Angell
<OPTION value=2>Jon Woodard
<OPTION value=9>Jonathan Ives
<OPTION value=8>Lyle Hall
<OPTION value=3>Robert Randal
<OPTION value=4>Stephen Flannery
<OPTION value=7>Stu Rich
<OPTION value=6>Tambra Gallant
</SELECT>
In the servlet code I have someting like the following to grab the
selected value in the form
try {
userId =
request.getParameter("Users.options[users.selectedIndex].value");
}
catch(Exception e) {
e.printStackTrace();
}
Unfortunately, it is not working. Please help.
--
This e-mail may contain confidential and/or privileged information. If you are not the
intended recipient (or have received this e-mail in error) please notify the sender
immediately and destroy this e-mail. Any unauthorised copying, disclosure or
distribution of the material in this e-mail is strictly forbidden.
___________________________________________________________________________
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