Hi All,

I am trying to get the ServletContext in the my Servlet and I am getting the
following exception. 

Without the ServletContext the code is working fine.

Hear is what I am trying to accomplish.

As of now after processing the request I am doing a response.sendRedirect to
let the JSP to handle the presentation of the HTML.

But I would like to reduce that round trip and be able to directly call or
forward the request to the JSP.

In order to do it I did the following
        String url = "/jsp/TestProj/Test.jsp";
        ServletContext sc = getServletContext();
        RequestDispatcher rd = sc.getRequestDispatcher(url);
        rd.forward(request,response);

But when my it try's to execute the getServletContext call I get the
following exception. Any Ideas?

Thanks,
Ravi

java.lang.NullPointerException
        at
javax.servlet.GenericServlet.getServletContext(GenericServlet.java:205)
        at
com.dpd.servlet.NavigationServlet.service(NavigationServlet.java:290)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1417)
        at
allaire.jrun.session.JRunSessionService.service(../session/JRunSessionServic
e.java:1082)
        at
allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:1271)
        at
allaire.jrun.servlet.JRunNamedDispatcher.forward(../servlet/JRunNamedDispatc
her.java:39)
        at allaire.jrun.servlet.Invoker.service(../servlet/Invoker.java:84)
        at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1417)
        at
allaire.jrun.session.JRunSessionService.service(../session/JRunSessionServic
e.java:1082)
        at
allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:1271)
        at
allaire.jrun.servlet.JRunRequestDispatcher.forward(../servlet/JRunRequestDis
patcher.java:89)
        at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1553)
        at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1543)
        at
allaire.jrun.servlet.JvmContext.dispatch(../servlet/JvmContext.java:364)
        at
allaire.jrun.jrpp.ProxyEndpoint.run(../jrpp/ProxyEndpoint.java:388)
        at allaire.jrun.ThreadPool.run(../ThreadPool.java:272)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to