According to the servlet's spec, the behavior of getParameter()
is undefined if you consumed the payload first through getInputStream
or getReader:
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
El mié, 05-10-2005 a las 08:46 -0400, Jean-Marc Marchand escribió:
According to the servlet's spec, the behavior of getParameter()
is undefined if you consumed the payload first through getInputStream
or getReader:
If the parameter data was sent in the request body, such as occurs
Hi all,
I'm trying the following , with Tomcat 5.5.12 ( Also with 5.0.30 ) ,
and after reading the request.getReader(), the
request.getParameter(param) is unusable, returning null.
I'm trying setting a mark in the BufferedReader, but the result it's the
same.
Any hint?
public void
Dave
You had me worried there, for a moment...
Surprisingly, the servlet spec is quite clear on this issue:
getParameter() is not valid for GET requests (which was totally
unexpected). Servlet Spec 2.3, Section SRV.4.1:
I read the specs again, and then I realised that you are getting
[mailto:[EMAIL PROTECTED]
Sent: Thursday, September 23, 2004 5:05 PM
To: Tomcat Users List
Subject: Re: getParameter() should be case insensitive?
On Sep 23, 2004, at 3:34 PM, Shapira, Yoav wrote:
Hi,
I guess the part where I said we didn't have a choice, we must
implement
the servlet spec
stating that the current, case sensitive getParameter()
behavior is correct? I've muddled through RFCs and can't seem to find
anything to support that.
Thanks!
-Dave
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
Hi,
This is, however, contrary to other APIs and even the HTML spec (I
believe). For example, Apache::Request treats parameter names as case
insensitive:
As you noted, the HTML spec doesn't apply to servlet containers, only
user agents. What ASP/ASP.NET do is also irrelevant. The Servlet
: Thursday, September 23, 2004 2:24 PM
To: Tomcat Users List
Subject: RE: getParameter() should be case insensitive?
Hi,
This is, however, contrary to other APIs and even the HTML spec (I
believe). For example, Apache::Request treats parameter names as case
insensitive:
As you noted
PROTECTED]
Sent: Thursday, September 23, 2004 4:31 PM
To: 'Tomcat Users List'
Subject: RE: getParameter() should be case insensitive?
Though it may be true that there are not requirements about case
insensitivity
in the specification, it would be nice to make the world consistent and
all
it
would
are case insensitive. So presumably
HttpRequest.getParameter() is case sensitive because *something* says
so... I just don't know what.
Surprisingly, the servlet spec is quite clear on this issue:
getParameter() is not valid for GET requests (which was totally
unexpected). Servlet Spec 2.3
If you want to discuss the servlet spec... please take it to the servlet spec group
whereever they may be.
This forum is for Tomcat specific questions. You already know the answer for how
Tomcat deals with the getParameter method.
[EMAIL PROTECTED] 09/23/04 02:04PM
On Sep 23, 2004, at 3
The % is a control character which needs to be urlEncoded. Browsers do this
automatically for you and HttpServlet automatically un-encodes these
characters for you when you use the getParameter method.
If your other apps are not encoding the data properly, then this is not really
a servlet
do this
automatically for you and HttpServlet automatically un-encodes these
characters for you when you use the getParameter method.
If your other apps are not encoding the data properly, then this is not really
a servlet/Tomcat issue. Take a look at:
http://www.php.net/urlencode
Dear all,
I'm quite new using HttpServlets, that's why I hope you can help me!
I'm using an HttpServlet on Tomcat 5 that is prepared to receive POST HTTP
requests from remote machines.
If I use an html form and I submit a text to this servlet (method post), the
get parameter of the http servlet
The % is a control character which needs to be urlEncoded. Browsers do this
automatically for you and HttpServlet automatically un-encodes these
characters for you when you use the getParameter method.
If your other apps are not encoding the data properly, then this is not really
a servlet
PROTECTED]
Sent: Tuesday, September 09, 2003 6:17 PM
To: [EMAIL PROTECTED]
Subject: NullPointer on getParameter
Hi, I'm trying to figure out a problem we've encountered since
upgrading
to Tomcat 4.1. I've seen this both on 4.1.24 and 4.1.27. I haven't yet
reduced it to a specific recipe
, 2003 6:17 PM
To: [EMAIL PROTECTED]
Subject: NullPointer on getParameter
Hi, I'm trying to figure out a problem we've encountered since
upgrading
to Tomcat 4.1. I've seen this both on 4.1.24 and 4.1.27. I
haven't yet
reduced it to a specific recipe for reproduction outside the
context
I have a problem with servlet's getParameter() method returning null
when I connect using chunked encoding. The client is an MIDP 2.0
emulator from Sun's Wireless Toolkit 2.0. Connections from Mozilla and
IE work fine, and they are not using chunked encoding.
I'm using Tomcat 4.1.27. Here
on getParameter
Hi, I'm trying to figure out a problem we've encountered since
upgrading
to Tomcat 4.1. I've seen this both on 4.1.24 and 4.1.27. I haven't yet
reduced it to a specific recipe for reproduction outside the context of
my application but I do see this quite frequently so I thought I'd see
if anyone else has come across it...
The problem is that a call to getParameter is getting a
NullPointerException in the delegation method on CoyoteRequestFacade:
Caused by:
java.lang.NullPointerException
at org.apache.coyote.tomcat4.CoyoteRequestFacade.
getParameter(CoyoteRequestFacade.java:178
PROTECTED]
Subject: NullPointer on getParameter
Hi, I'm trying to figure out a problem we've encountered since
upgrading
to Tomcat 4.1. I've seen this both on 4.1.24 and 4.1.27. I haven't yet
reduced it to a specific recipe for reproduction outside the context of
my application but I do see this quite
: Tuesday, September 09, 2003 6:17 PM
To: [EMAIL PROTECTED]
Subject: NullPointer on getParameter
Hi, I'm trying to figure out a problem we've encountered since
upgrading
to Tomcat 4.1. I've seen this both on 4.1.24 and 4.1.27. I haven't yet
reduced it to a specific recipe for reproduction outside
way to get the exception.
Yoav Shapira
Millennium ChemInformatics
-Original Message-
From: Laurie Harper [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 09, 2003 6:17 PM
To: [EMAIL PROTECTED]
Subject: NullPointer on getParameter
Hi, I'm trying to figure out a problem
Hi
I found an interesting problem ...
If I run http://../webdavservlet?param1=YYY
req.getParameter(param1) returns YYY ONLY IF I run the webdav servlet in the
regular way (open IE - type in the URL and return). If I run webdav servlet the
webdav way (File | Open
Has anyone used Tomcat with jspsmartupload? I have a question about using
jspsmartupload with Tomcat 4.0.4 in development and having the jspsmartupload
getparameter work. I have created a jar file with all the jspsmartupload components
and put it into the Tomcat lib directory. I then created
]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 03, 2001 6:38 PM
Subject: getparameter
Hi,
I use jakarta-tomcat-3.2.3 and jdk1.3.1_01 apache1.3.19 on Linux 2.2.19.
I created a file prova.jsp
html
head
title Prova /title
/head
body
: getparameter
Hi,
I use jakarta-tomcat-3.2.3 and jdk1.3.1_01 apache1.3.19 on Linux 2.2.19.
I created a file prova.jsp
html
head
title Prova /title
/head
body
%
out.println(bCiao: + request.getParameter(user) +
/b
:37 PM
Subject: Re: getparameter
Dmitri Colebatch wrote:
works fine for me on java 1.3 from sun.
On Wed, 3 Oct 2001, Roberto B. wrote:
I use linux (debian), T3.2.3 and jsdk 1.4 ...and your code works!
Try to upgrade to jsdk 1.4
R.
- Original Message -
From
simon wrote:
It seems to be working fine for everyone else so it's probably not a JDK version
problem.
What happens it you add another parameter:
html
head
title Prova /title
/head
body
%
out.println(bCiao: + request.getParameter(user) + /b);
Dmitri Colebatch wrote:
how are you calling it? I literally cut and pasted it into a file
(attached) in and saved it in the examples context of a normal install -
worked fine.
cheers
dim
I put the file in the correct directory and then I call it with the
browser
at the URL
Hi,
I use jakarta-tomcat-3.2.3 and jdk1.3.1_01 apache1.3.19 on Linux 2.2.19.
I created a file prova.jsp
html
head
title Prova /title
/head
body
%
out.println(bCiao: + request.getParameter(user) +
/b);
out.println(bbrCiao: + request.getMethod() + /b);
I use linux (debian), T3.2.3 and jsdk 1.4 ...and your code works!
Try to upgrade to jsdk 1.4
R.
- Original Message -
From: Michele Cerioni [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 03, 2001 6:38 PM
Subject: getparameter
Hi,
I use jakarta-tomcat-3.2.3
Roberto B. wrote:
I use linux (debian), T3.2.3 and jsdk 1.4 ...and your code works!
Try to upgrade to jsdk 1.4
R.
jsdk1.4 from java.sun.com/j2se is betaIs this jdk1.4 stable?
Michele
JDK 1.4 is in beta release
byez
Alessandro
- Original Message -
From: Michele Cerioni [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 03, 2001 7:29 PM
Subject: Re: getparameter
Roberto B. wrote:
I use linux (debian), T3.2.3 and jsdk 1.4 ...and your code works
For now... I have no problem.
However.. you could try jsdk 1.3
R.
- Original Message -
From: Michele Cerioni [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 03, 2001 7:29 PM
Subject: Re: getparameter
Roberto B. wrote:
I use linux (debian), T3.2.3 and jsdk 1.4
Hi,
I'am using ISO-8859-2 for pages encoding.
I'm using %@page contentType="text/html; charset=iso-8859-2"% in header
of each file.
But Tomcat doesn't use information for page encoding to correctly decode
strings from forms.
It's interesting that on my machine at home it works and ont
are
going to use this technique.
Cheers
Hemant
- Original Message -
From: Oskar Zinger [EMAIL PROTECTED]
To: TomcatDev [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Sunday, June 03, 2001 12:15 AM
Subject: get/setAttribute and getParameter...
Hi,
What is more time consuming?
JSP1
page=JSP2.jsp flush=true/
JSP2:
% if (request.getAttribute(FLAG) == true)
{
/* ... */
}
%
(At a guess, setAttribute()/getAttribute() is going to be faster than
getParameter(), just because you avoid parsing the request string, but it's
worth comparing the two
Hi,
I am not sure which is the best way. I usually use the First one for my
job.
Regards
Moin.
Oskar Zinger wrote:
Hi,
What is more time consuming?
JSP1:
% request.setAttribute(FLAG, new Boolean(true)); %
jsp:include page=JSP2.jsp flush=true/
JSP2:
% boolean FLAG = ((Boolean)
Hi,
What is more time consuming?
JSP1:
% request.setAttribute(FLAG, new Boolean(true)); %
jsp:include page=JSP2.jsp flush=true/
JSP2:
% boolean FLAG = ((Boolean)
request.getAttribute(FLAG)).booleanValue();
if (FLAG) {
..
...
}
%
OR?:
JSP1:
jsp:include
Hi All,
I'm new to the list and I'm setting up Tomcat 3.2 + IIS and we get the
problem stated in http://znutar.cortexity.com/BugRatViewer/ShowReport/55
and http://w4.metronet.com/~wjm/tomcat/ToFeb11/msg02723.html (getParameter
is null when values from a HTML FORM are sent to a JSP
Eric,
Hi
Are you using by any change this option when doing a post :
enctype="multipart/form-data" ?
Not at all, I'm using the form (and JSP code) attached to this e-mail.
Cheers
--
Vctor A. Rodrguez ( http://www.bit-man.com.ar)
Telefnica de Argentina - http://www.Telefonica.com.ar
Eric,
thanks for your soon answer !!
unfortunately there's no change, even when all text was uppercase.
I also played with upper/lower case when getting the parameters in the JSP,
but unless the case are exactly the same for each file (HTML and JSP) the
obtained result is null (for NetScape,
Hi All,
this is my first post to the list, and I'm not currently subscribed
tomcat-user.
I'm setting up Tomcat 3.2 + IIS and we get the problem stated in
http://znutar.cortexity.com/BugRatViewer/ShowReport/55 and
http://w4.metronet.com/~wjm/tomcat/ToFeb11/msg02723.html (getParameter is
null
Hi, I have a servlet which dispatches out various jsp's. Some of the jsp's
resulting html contain links back to the servlet to fire off another page
like this:
A HREF="mainservlet?cmd=loadpage=home"HOME/A
When I do a request.getParameter("cmd") the string I get is "cmd" which is
right.
When I do
No you are not doing anything wrong. But I think you are using a name that is allready
reserved for a parameter. (Please correct me if I'm wrong)
Try changing page to page1 or something different and see the result.
Stefan
It looks like the "page" could be a key-word and is pulling
"mainservlet?cmd=load",try changing page to something like "pg" and see if u
get the same error.
Ram
From: Matt Becker [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: get
Hi, Ram!
I tried changing the name "page" to "pg" but that didn't change that
getParameter() returns other part of the text that's not part of the "pg"
variable. I thought maybe I was doing something wrong with the URL in how
the parameters were being passed in
On Tuesday January 16, 2001 Matt Becker wrote:
Hi, Ram!
I tried changing the name "page" to "pg" but that didn't change that
getParameter() returns other part of the text that's not part of the "pg"
variable. I thought maybe I was doing something wrong with t
PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: getParameter() help
Date: Tue, 16 Jan 2001 14:07:56 -0800
Hi, Ram!
I tried changing the name "page" to "pg" but that didn't change that
getParameter() returns other part of the text that's not part of
ng it right.Try restarting the server and close all browser
windows that are open(just to make sure that the browser is not dishing
out the cached page).Also please post your code so that we can take a look
at it.
hope this solves your problem
Ram
From: Matt Becker [EMAIL PROTECTED]
Reply-To: [
ubject: Re: getParameter() help
Date: Tue, 16 Jan 2001 14:45:22 -0800
Here's a boiled down version of my code.
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException
{
String cmd = request.getParameter("cmd"
I modded your code and made it a JSP so it was easy for me.
The following URLs work as expected. You will need to change /livelink/ms
to whatever webapp you use, I just put it in there cuz it was easy
http://localhost:8080/livelink/ms/foo.jsp
http://localhost:8080/livelink/ms/foo.jsp?cmd=load
Are you using Tomcat 3.2.1 as a standalone browser or in combination with apache or
similar browser??
I tried to check if home is a reservered word but it works fine with my setup (Tomcat
standalone, win2k, IE5.5)
Even page works without problem.
My suggestion is as RAmkumar said that
you try what Elijah suggested.I think elijah is right in pointing out
about the "home" word,probably the browser/server is substituting home
with the value u r getting.
Ram
From: Matt Becker [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: getParameter()
Actually the test that you want is:
if (user.compareTo("admin") == 0) {
...
}
-Original Message-
From: Cliff Rowley [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 18, 2000 7:35 AM
To: [EMAIL PROTECTED]
Subject: RE: getParameter is NO
Note for newer Java programmers:
For this example, they are equivalent. But String.compareTo() returns an int
and can be used, like the C function memcmp(), to test all of , ==, and .
In addition to String.equals(), do not overlook String.equalsIngoreCase(),
should you need a
if (user == "admin")
{
}
then it doesnt go into this condition, but goes into the ELSE instead!!!
Why is this?
You need to do some basic Java study.
The conditional test above actually asks this:
If
the explicit String type object reference 'user' points to the same
Brett Bergquist wrote:
Actually the test that you want is:
if (user.compareTo("admin") == 0) {
...
}
And how is this any different from using "if (user.equals("admin"))"?
The method 'compareTo(Object o)' is specified in java.lang.Comparable, which
Miles Daffin wrote:
Brett Bergquist wrote:
Actually the test that you want is:
if (user.compareTo("admin") == 0) {
...
}
And how is this any different from using
"if (user.equals("admin"))"?
...
'compareTo(Object o)' returns an int
...
Hi Charles,
A few notes:
1) java.lang.Comparable is new in Java2. It's not there
if you are running w/Java 1.1 (OK with Tomcat 3.x).
2) compareTo(), for Strings does a *lexical* comparison.
Semantically, this code wants to know that the user
is "admin", not that the user is
: getParameter is NOT a string?
Brett Bergquist wrote:
Actually the test that you want is:
if (user.compareTo("admin") == 0) {
...
}
And how is this any different from using "if (user.equals("admin"))"?
--
Kurt Pruenner - Haendel
62 matches
Mail list logo