Forums Register Login

getParameter() in HttpServlet

+Pie Number of slices to send: Send
Hi all
When I use a HTML Form using the POST methode I can not get the parameter name and value from an input field with . Only with I can read the information.
Is that right or am I doing something wrong?
Thanks
Roland
+Pie Number of slices to send: Send
Hi Roland,
you can use with post and get:
-HttpServletRequest.getParameter(String fieldName);
-HttpServletRequest.getParameterNames();
Returns an Enumeration of String objects containing the names of the parameters contained in this request.
- HttpServletRequest.getParameterValues(String fieldName)
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
You find more detailled informations here:
http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletRequest.html.
These methods are FAR more common and easy to use than the getInputStream().
No time to test now, but I strongly believe that the request.getInputStream() works only with doPost(). Not with doGet(). We had a discussion in this forum some time ago about the very similar getReader method.
http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=18&t=000755
regards axel

[ February 05, 2002: Message edited by: Axel Janssen ]
You have to be odd to be #1 - Seuss. An odd little ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 668 times.
Similar Threads
getParameter on checkbox returning null even though it's checked!
getParameter
need help on passing string
confused between attributes and parameters
How to pass parameter in multipart post request
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:19:41.