tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Linzer <jlin...@alabanza.com>
Subject Re: ServletContext.setAttribute()
Date Mon, 17 Jul 2000 19:53:55 GMT
Thanks.
That was the problem. I used now req.getRequestDispatcher("myJSP.jsp") with req being a request
object. and
it worked. I had been using getServletContext.getRequestDispatcher("myJSP.jsp") which didn't
make sense to
me but it was in my JSP book (Webdevelopment with JSP by Fields & Kolb) so I figured it
should work

Jeremy

"Eric H." wrote:

> Where did you get the RequestDispatcher?
> Did you do something like:
>
> (where request is the HttpServletRequest sent to your servlet and
>  response is the HttpServletResponse)
>
> RequestDispatcher rd=request.getRequestDispatcher("../path/some.jsp");
> rd.forward(request,response);
>
> On Fri, 14 Jul 2000, Jeremy Linzer wrote:
>
> > Hi all,
> >
> > I am pretty new to this and I have what maybe a simple question. I wrote
> > a simple Servlet (passes a message to a JSP and JSP outputs it). It
> > compiles fine but when I try accessing it I got a 500 error:
> >
> > java.lang.NullPointerException:
> >         at HelloWorldServlet.service(HelloWorldServlet.java:14)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >         at
> > org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
> >
> >         at
> > org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> >         at
> > org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
> >
> >         at
> > org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
> >
> >         at java.lang.Thread.run(Thread.java)
> >
> > line 14 that it refers to in the servlet is rd.forward(req, res);
> > rd is of type RequestDispatcher
> >
> > If anyone has any ideas or suggestions I would really appreciate it.
> >
> > THanks,
> > Jeremy
> >
> >
> >
>
> -Eric Harashevsky, USC ISD Student Consultant


Mime
View raw message