Lets say my form called a servlet. I would do some processing in it. In the servlet i want to print something on the page. for that i used
PrintWriter out=response.getWriter();
out.println("some text here");
then further in the servlet i did some more form processing which works fine and after that i want the servlet to be forwarded to a jsp page. For this i used
RequestDispatcher rd = request.getRequestDispatcher("/somepage.jsp");
rd.forward(request, response);
the problem comes here. the text
some text here
gets printed, but the servlet doesn't forward request to the jsp page, as if the code doesn't run.