Okay everybody, say it with me.  RTFM!

If you had actually bothered to read a book or check out the javadocs you
would have noticed this:
>From the java docs http://java.sun.com/j2ee/j2sdkee/techdocs/api/index.html
(under javax.servlet.ServletRequest):
getParameter

public java.lang.String getParameter(java.lang.String name)

     Returns the value of a request parameter as a String, or null if the
parameter does not exist. Request parameters are extra information sent
with the request. For HTTP servlets, parameters are contained in the query
string or posted form data.

     You should only use this method when you are sure the parameter has
only one value. If the parameter might have more than one value, use
getParameterValues(java.lang.String).

     If you use this method with a multivalued parameter, the value
returned is equal to the first value in the array returned by
getParameterValues.

     If the parameter data was sent in the request body, such as occurs
with an HTTP POST request, then reading the body directly via
getInputStream() or getReader() can interfere with the execution of this
method.
     Parameters:
          name - a String specifying the name of the parameter
     Returns:
          a String representing the single value of the parameter
     See Also:
          getParameterValues(java.lang.String)

A little research into solving your own damn problem before posting to the
list goes a long way.
--Angus



"Gillies, David (EDU)" wrote:
>
> First post for me...  We're running Apache 1.3.12 with Tomcat 3.1 for
> servlets/JSP.  And unfortunately, our development box is NT.  There is
> something strange happening with form submissions - particularly with
> multiple select boxes.  Here is a piece of HTML with a form that submits to
> a JSP that prints out the results with request.getParameter().
>
> test.html:
> <HTML>
> <BODY>
> <FORM method="post" action="process.jsp">
> <SELECT name="b" multiple>
> <OPTION name="b1">1</OPTION>
> <OPTION name="b2">2</OPTION>
> <OPTION name="b3">3</OPTION>
> </SELECT>
> <INPUT TYPE=submit>
> </FORM>
> </BODY>
> <HTML>
>
> process.jsp:
> B:<%
> out.println(request.getParameter("b"));
> %>
>
> Look folks, it doesn't get any easier than this!  The problem is that
> whenever I select more than one item in the select, getParameter reports
> only one.  This exact piece of code works on our old JavaWebServer 2.0
> server.  What gives?  The production box will run Solaris 2.7 with Apache
> and Tomcat as well, but is still being put together so I can't test it
> there.  Is this just shoddy NT implementation of Apache/Tomcat ?  Any ideas
> would be very helpful.
>
> Dave
>
> Dave Gillies
> Web Programmer
> Learning Technologies Unit
> E230-1970 Ness Avenue
> Phone: (204) 945-7497
> Fax: (204) 945-1704
> EMail: [EMAIL PROTECTED]
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to