I'm developing an application in JAVA where a servlet is taking the inputs from a JSP page. After inserting the values in db it will redirect to another servlet. Then the 2nd servlet will dispatch a JSP page with an ArrayList. But I can't redirect from the 2nd servlet to the JSP page. The ArrayList is going to the JSP page but the page is not showing anything. I'm using NetBeans 6.8.

Code for 1st Servlet:

RequestDispatcher dispatcher = request.getRequestDispatcher("/Servlet1?id="+id);
dispatcher.forward(request, response);

Code for 2nd Servlet:

String url="test2.jsp";
RequestDispatcher v=request.getRequestDispatcher(""+url+"");
v.forward(request, response);

I've put a System.out.println("list values::"+list.get(0)); in the final JSP page. It is working and print the value which I can see in the output console in Netbeans. But the page is not displayed. The 2nd servlet is working properly when I'm accessing it directly. But when I'm accessing it through another servlet the problem is arises.

I'll be thankful if anyone can solve this problem.

Edited by pritaeas: Updated title.

5 Years
Discussion Span
Last Post by nadim123

I cant get your question, 2nd servlet not redirect on jsp or 1st servlet not redirect to 2nd servlet?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.