tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kaushal Shriyan" <kaushalshri...@gmail.com>
Subject Re: JSP Code to capture HTTP headers
Date Mon, 31 Jul 2006 11:12:02 GMT
On 7/31/06, Shinya Koizumi <skoizumi@basicengineering.ca> wrote:
>
> use these methods
>
>   <%= request.getParameter() %>
>   <%= request.getParameterNames() %>
> or  you look up javax.serlvet.HttpServletRequest
>
> ----- Original Message -----
> From: "Kaushal Shriyan" <kaushalshriyan@gmail.com>
> To: "Tomcat Users List" <users@tomcat.apache.org>
> Sent: Monday, July 31, 2006 12:10 AM
> Subject: JSP Code to capture HTTP headers
>
>
> > Hi ALL
> >
> > I have a sample php code,
> >
> > <?php header("Content-Type: text/html"); ?>
> > <h1>ENV</h1>
> > <?php
> > foreach ($_ENV as $key => $value) {
> >       echo "Key: $key, value: $value";
> >       echo "<br>";
> > }
> > ?>
> > <h1>SERVER</h1>
> > <?php
> > foreach ($_SERVER as $key => $value) {
> >       echo "Key: $key, value: $value";
> >       echo "<br>";
> > }
> > ?>
> > <h1>COOKIE</h1>
> > <?php
> >
> > foreach ($_COOKIE as $key => $value) {
> >       echo "Key: $key, value: $value";
> >       echo "<br>";
> > }
> > ?>
> > <h1>GLOBALS</h1>
> > <?php
> > foreach ($GLOBALS as $key => $value) {
> >       echo "Key: $key, value: $value";
> >       echo "<br>";
> > }
> > ?>
> >
> > I wanted this to work in JSP(Java Server Pages)
> >
> > Thanks and Regards
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Hi Shinya

I created a test file called test.jsp and placed in
/usr/local/tomcat/jakarta-tomcat-4.1.31/webapps/examples/jsp/
and accessed http://localhost:8080/examples/jsp/test.jsp
The test.jsp contains
<%= request.getParameter() %>
<%= request.getParameterNames() %>

I am getting

*type* Exception report

*message* **

*description* *The server encountered an internal error () that prevented it
from fulfilling this request.*

*exception*

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 0 in the jsp file: /jsp/test.jsp

Generated servlet error:
    [javac] Compiling 1 source file

/usr/local/tomcat/jakarta-tomcat-4.1.31/work/Standalone/localhost/examples/jsp/test_jsp.java:41:
getParameter(java.lang.String) in javax.servlet.ServletRequest cannot
be applied to ()
      out.print( request.getParameter() );
                        ^
1 error


	at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
	at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:248)
	at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:315)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:328)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:427)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:142)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:445)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:534)

 ------------------------------


Apache Tomcat/4.1.31

Thanks and Regards

Kaushal

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message