Hi,
First let me see if I understand the question:
say that your HTML select is set up as in this fragment..
<HTML>...<BODY>...
<FORM ACTION = "someservlet">...
<SELECT SIZE = "1"
NAME="SELECTVAL"><OPTION>First</OPTION><OPTION>Second</OPTION></SELECT>...
<INPUT TYPE="SUBMIT">...
</FORM>..
</BODY>
</HTML>
My understanding is that when the user clicks on submit, you want
'someservlet' to find whether the user chose 'First' or 'Second' from the
select.  You then want to take the value of that choice and store it for
later use.  If my understanding is correct, you may wish to use the
getParameter method in 'someservlet' and putting the result into a session
variable:
...
...
public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
{
 HttpSession mySession=request.getSession(true);
 //We now have a session called mySession
...
 String UsersChoiceFromSelect = request.getParameter("SELECTVAL");
 //SELECTVAL was the NAME of the SELECT in the HTML  above
 //for 2.1 API use the next line...
 mySession.putValue("SelectChoice",UsersChoiceFromSelect );
 //...or for 2.2 API uncomment the next line and use it instead
 //mySession.setAttribute("SelectChoice",UsersChoiceFromSelect );
...
 //Now when we want to retrieve the value that the user picked for SELECTVAL
 //in another servlet we refer to the session variable "SelectChoice"
...
}

-----Original Message-----
From: Bill Wyza [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 14, 2000 6:35 AM
To: [EMAIL PROTECTED]
Subject: Servlet question on passing variables


I have a servlet that generates a dynamic html page with a select box
on it.  The user must select an item from the list and press submit.  I
need
to capture the value of the select box and pass it to another procedure
in the servlet to create a second dynamic page.

How to I get the value of the select box and keep it for later use?

Bill

___________________________________________________________________________
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