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:
request.setAttribute("list",list); 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.