You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Ray Pitmon <rp...@digitalcyclone.com> on 2001/05/10 13:08:50 UTC
request.getparamter doesn't return anything without an '=' (equals) in the query string
Hi,
*I first posted this to users, but was suggested that I post it to dev*.
I apologize if this has been talked about before. (I was surprised I couldn't
find anything in the archives.)
When browsing a URL with a query string, Tomcat doesn't seem to recognize it
unless there's an '=' in it. (it returns a null if there's no '=') Actually,
Tomcat sees it, but it doesn't get passed to the servlet/jsp.
We are using IPlanet 4.1 (without Tomcat), and it seems to work fine. When I
try it on Apache/Tomcat, it doesn't work (needs the '='). I personally don't
think it would be that much of a deal to change it, but there's a lot of code
already written.
I am using java1.3, have tried tomcat 3.2.1 and 3.2.2b4 (ajp13 interface)
Here's a jsp that shows an example:
[root@web4]$ cat getparam.jsp
<html><head></head>
<body>
This page is looking for x<br>
<%= request.getParameter("x") %>
</body>
</html>
--
Here's what I get when I browse this URL: http://web.server.com/getparam.jsp?x
-----
(IPlanet)
This page is looking for x
-----
(apache/tomcat)
This page is looking for x
null
-----
(notice the null returned from apache/tomcat)
Same URL with an '=' on the end: http://web.server.com/getparam.jsp?x=
----
(IPlanet)
This page is looking for x
----
(apache/tomcat)
This page is looking for x
---
(no null!)
Here's part of my jasper.log(note after request params):
(without the '=' in the URL)
2001-05-10 05:07:34 - JspEngine --> /getparam.jsp
2001-05-10 05:07:34 - ServletPath: /getparam.jsp
2001-05-10 05:07:34 - PathInfo: null
2001-05-10 05:07:34 - RealPath: /home/httpd/my-cast/getparam.jsp
2001-05-10 05:07:34 - RequestURI: /getparam.jsp
2001-05-10 05:07:34 - QueryString: x
2001-05-10 05:07:34 - Request Params:
2001-05-10 05:07:34 - Classpath according to the Servlet Engine is: ....
------------
(with the '=' in the URL)
2001-05-10 05:08:28 - JspEngine --> /getparam.jsp
2001-05-10 05:08:28 - ServletPath: /getparam.jsp
2001-05-10 05:08:28 - PathInfo: null
2001-05-10 05:08:28 - RealPath: /home/httpd/my-cast/getparam.jsp
2001-05-10 05:08:28 - RequestURI: /getparam.jsp
2001-05-10 05:08:28 - QueryString: x=
2001-05-10 05:08:28 - Request Params:
2001-05-10 05:08:28 - x =
2001-05-10 05:08:28 - Classpath according to the Servlet Engine is: ....
Is my developer just not using request.getparameter right and IPlanet is broken
by functioning the way it does, or is Tomcat broken? Tomcat & IPlanet show
different results with the exact same code.
thanks for any help I can get... I would really like to get this working with
Apache/Tomcat.
----------------------
Ray Pitmon
Digital Cyclone, Inc.
rp@digitalcyclone.com
http://www.my-cast.com
Re: request.getparamter doesn't return anything without an '='
(equals) in the query string
Posted by "Craig R. McClanahan" <cr...@apache.org>.
It's my belief that iPlanet is not parsing this correctly.
The specification does not give details on the expected syntax, but it is
interesting to note that the HttpUtils.parseQueryString() method requires
name=value pairs in order to parse request parameters. The same format is
used to parse data from the input stream on a POST request.
If you just want the part of the request that follows the "?" character,
and don't need it parsed to request parameters, you can simply call:
String value = request.getQueryString();
instead.
Craig McClanahan
On Thu, 10 May 2001, Ray Pitmon wrote:
> Hi,
>
> *I first posted this to users, but was suggested that I post it to dev*.
>
> I apologize if this has been talked about before. (I was surprised I couldn't
> find anything in the archives.)
>
> When browsing a URL with a query string, Tomcat doesn't seem to recognize it
> unless there's an '=' in it. (it returns a null if there's no '=') Actually,
> Tomcat sees it, but it doesn't get passed to the servlet/jsp.
>
> We are using IPlanet 4.1 (without Tomcat), and it seems to work fine. When I
> try it on Apache/Tomcat, it doesn't work (needs the '='). I personally don't
> think it would be that much of a deal to change it, but there's a lot of code
> already written.
>
> I am using java1.3, have tried tomcat 3.2.1 and 3.2.2b4 (ajp13 interface)
>
> Here's a jsp that shows an example:
>
> [root@web4]$ cat getparam.jsp
> <html><head></head>
> <body>
> This page is looking for x<br>
> <%= request.getParameter("x") %>
> </body>
> </html>
>
> --
> Here's what I get when I browse this URL: http://web.server.com/getparam.jsp?x
> -----
> (IPlanet)
>
> This page is looking for x
> -----
> (apache/tomcat)
>
> This page is looking for x
> null
> -----
> (notice the null returned from apache/tomcat)
>
>
> Same URL with an '=' on the end: http://web.server.com/getparam.jsp?x=
> ----
> (IPlanet)
>
> This page is looking for x
> ----
> (apache/tomcat)
>
> This page is looking for x
> ---
> (no null!)
>
>
> Here's part of my jasper.log(note after request params):
>
> (without the '=' in the URL)
> 2001-05-10 05:07:34 - JspEngine --> /getparam.jsp
> 2001-05-10 05:07:34 - ServletPath: /getparam.jsp
> 2001-05-10 05:07:34 - PathInfo: null
> 2001-05-10 05:07:34 - RealPath: /home/httpd/my-cast/getparam.jsp
> 2001-05-10 05:07:34 - RequestURI: /getparam.jsp
> 2001-05-10 05:07:34 - QueryString: x
> 2001-05-10 05:07:34 - Request Params:
> 2001-05-10 05:07:34 - Classpath according to the Servlet Engine is: ....
> ------------
> (with the '=' in the URL)
> 2001-05-10 05:08:28 - JspEngine --> /getparam.jsp
> 2001-05-10 05:08:28 - ServletPath: /getparam.jsp
> 2001-05-10 05:08:28 - PathInfo: null
> 2001-05-10 05:08:28 - RealPath: /home/httpd/my-cast/getparam.jsp
> 2001-05-10 05:08:28 - RequestURI: /getparam.jsp
> 2001-05-10 05:08:28 - QueryString: x=
> 2001-05-10 05:08:28 - Request Params:
> 2001-05-10 05:08:28 - x =
> 2001-05-10 05:08:28 - Classpath according to the Servlet Engine is: ....
>
>
> Is my developer just not using request.getparameter right and IPlanet is broken
> by functioning the way it does, or is Tomcat broken? Tomcat & IPlanet show
> different results with the exact same code.
>
>
> thanks for any help I can get... I would really like to get this working with
> Apache/Tomcat.
>
> ----------------------
> Ray Pitmon
> Digital Cyclone, Inc.
> rp@digitalcyclone.com
>
> http://www.my-cast.com
>