Hi
I have had a null pointer exception with this method in a servlet
private void gotoPage( String Address,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException , IOException {
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(Address);
dispatcher.forward(request, response);
}
when used in the following scenario
page1 -> servlet1 -> page2 -> servlet2 ->{fails} back to page 2
I can forward ok from servlet1 to page2
servlet2 "hangs" in the browser and there is a null pointer exception
in the gotoPage method -.
are there any particular things which i need to set up to forward to any page for the second time?
java.lang.NullPointerException
at javax.servlet.GenericServlet.getServletContext(GenericServlet.java:205)
at orders.submitData.gotoPage(submitData.java:31)
at orders.submitData.performTask(submitData.java:321)
at orders.submitData.doGet(submitData.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:721)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:797)
at java.lang.Thread.run(Thread.java:484)
Process exited.
Any ideas on how I can find out what is causing the problem or fix it?
Second question : Is it better to have one servlet which controls all logic rather than two or more servlets - any comments gratefully appreciated
Many thanks
I have had a null pointer exception with this method in a servlet
private void gotoPage( String Address,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException , IOException {
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(Address);
dispatcher.forward(request, response);
}
when used in the following scenario
page1 -> servlet1 -> page2 -> servlet2 ->{fails} back to page 2
I can forward ok from servlet1 to page2
servlet2 "hangs" in the browser and there is a null pointer exception
in the gotoPage method -.
are there any particular things which i need to set up to forward to any page for the second time?
java.lang.NullPointerException
at javax.servlet.GenericServlet.getServletContext(GenericServlet.java:205)
at orders.submitData.gotoPage(submitData.java:31)
at orders.submitData.performTask(submitData.java:321)
at orders.submitData.doGet(submitData.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:721)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:797)
at java.lang.Thread.run(Thread.java:484)
Process exited.
Any ideas on how I can find out what is causing the problem or fix it?
Second question : Is it better to have one servlet which controls all logic rather than two or more servlets - any comments gratefully appreciated
Many thanks