You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ivan Venuti <i....@caribel.pisa.it> on 2002/12/09 16:48:10 UTC
Can't read POST parameters in a Servlet
Hi,
I have this problem: from an HTML page I call a Servlet via a form like this:
<form name="richiesta" method="post" action="servletName">
<input type="hidden" name="in_file" value="00009177.doc">
...
<input type="hidden" name="port" value="8787">
</form>
In the Servlet I retrieve the parameters with request.getParameter("paramName");
With Tomcat3.x everithing goes well, but with Tomcat 4.0.3 I can't retrieve the parameters in the Servlet: every getParameter returns "null", and printing all with
for (Enumeration namesList = request.getParameterNames(); namesList.hasMoreElements();)
{
String curName =(String)namesList.nextElement();
System.out.println("Param "+curName+" value: '"+request.getParameter(curName)+"'");
}
prints nothing!
I really can't figure out where to look for a solution. Any help is welcome!
-- Ivan Venuti --
Re: Can't read POST parameters in a Servlet
Posted by David Brown <dw...@webitplanet.com>.
Ivan Venuti writes:
> Hi,
>
> I have this problem: from an HTML page I call a Servlet via a form like this:
>
> <form name="richiesta" method="post" action="servletName">
>
> <input type="hidden" name="in_file" value="00009177.doc">
>
> ...
>
> <input type="hidden" name="port" value="8787">
>
> </form>
>
> In the Servlet I retrieve the parameters with request.getParameter("paramName");
>
> With Tomcat3.x everithing goes well, but with Tomcat 4.0.3 I can't retrieve the parameters in the Servlet: every getParameter returns "null", and printing all with
>
> for (Enumeration namesList = request.getParameterNames(); namesList.hasMoreElements();)
>
> {
>
> String curName =(String)namesList.nextElement();
>
> System.out.println("Param "+curName+" value: '"+request.getParameter(curName)+"'");
>
> }
>
> prints nothing!
>
> I really can't figure out where to look for a solution. Any help is welcome!
>
> -- Ivan Venuti --
>
Hello Ivan, in the examples i think their is a servlet called the
EchoServlet.java. this servlet simply prints the complete requests headers
and parms for both get and post and other info (meta data etc.). u could try
this a diagnostic tool. once the servlet is running all u have to do is
temporarily put: http://localhost:8888 in ur form action to see the results.
hope this helps, david.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>