Parith
Parith

Reputation: 85

How can I pass an ArrayList from one servlet another?

I have already sent arraylist1 from one servlet to another. 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?

Upvotes: 0

Views: 1553

Answers (2)

drekka
drekka

Reputation: 21883

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.

Upvotes: 0

Guillaume
Guillaume

Reputation: 14656

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

Upvotes: 2

Related Questions