How can I pass an ArrayList from one servlet another?
I have already sent arraylist1 from one servlet to anot开发者_开发百科her. It works. Now I want to pass arraylist2 to another jsp/servlet, but I get an error: java.util.nullPointer Exception
. How can I resolve this?
RequestDispatcher disp2 = request.getRequestDispatcher("NewServlet.java");
should be
RequestDispatcher disp2 = request.getRequestDispatcher(pathToYourServlet);
The path is the end of the page adress: http://localhost/yourApp/pathToYourServlet
You need to look at the full stack trace of the null pointer to establish where it is coming from. Then you should debug through that line by line to see where the null is. From there you should be able to back trace to the source. These are very general statements, but they are how I would approach your problem given the little information provided.
精彩评论