tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ishmael Riles" <ishm...@zendostudios.com>
Subject Re: Please Help. bug with getParameter() and getQueryString()
Date Mon, 15 May 2000 23:55:46 GMT
From: David R. Smith <clara1mom@home.com>


> It's not a bug just because your code doesn't work. Give some example code
> so we can see what you're doing.
Yeah. I am pretty sure it's not a bug in tomcat It probably has to do with
my configuration.

But below is my code. My configuration files are probably more relevant to
the problem at hand but I am not sure wich ones I should send.

********* CODE STARTS HERE
**************************************************

import java.io.PrintWriter;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;

/**
 *
 *
 * @author Ishmael Riles <ishmael@zendostudios.com>
 *
 */

public class HelloWorld extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse
response)
       throws IOException
   {
        PrintWriter out = response.getWriter();
        response.setContentType("text/plain");

        // this returns ""
       out.println ("getQueryString() " + request.getQueryString());

       // this returns the correct stuff.
       // this returns "http://<server-name>/servlet/HelloWorld?param1=stuff
       out.println ("getRequestURI() "+request.getRequestURI());

        out.println("Hello World Servlet");
        out.println();

        // request.getParameter( "param1") returns null
        out.println ( "recordingId = "+request.getParameter ( "param1" ));

        // this returns an empty Enumeration.
        Enumeration enum = request.getParameterNames ();

        while ( enum.hasMoreElements() ) {
                out.println ("parameter names");
                out.println ( enum.nextElement().toString() );
         }
        out.close();
    }
}




> ----- Original Message -----
> From: "Ishmael Riles" <ishmael@zendostudios.com>
> To: <tomcat-user@jakarta.apache.org>
> Sent: Monday, May 15, 2000 4:58 PM
> Subject: Please Help. bug with getParameter() and getQueryString()
>
>
> > Hello,
> >
> > I am new to Tomcat so I may be making a newbie mistake. I have written a
> > bunch of servlets that work great but when I make calls to
> > HttpServletRequest.getParameter() from with in the doGet method of a
basic
> > Hello World type servlet I get a null object. I have also tried
> > HttpServletRequest.getParmaterNames() wich returns an empty Enumeration.
> > getQueryString() returns an empty string but getRequestURI() returns the
> > whole http request including the parameters.
> >
> > Does anyone have any idea what might be causing this bug? Could I have
> made
> > an error configuring tomcat. I am using apache on Linux (mandrake
distro)
> > and I don't see the bug when I go through the built in web server.
> >
> > Here's the version info:
> > Apache version 1.3.9
> > jdk 1.2.2
> > tomcat 3.1
> >
> > I'd be happy to send conf files if they will help.
> >
> > Thanks in advance,
> >
> > Ishmael.
> >
> >
>
> --------------------------------------------------------------------------
> > To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commmands, email: tomcat-user-help@jakarta.apache.org
> >
>


Mime
View raw message