I am writing a simple Web application using only jsp and servlets. I have a form in a jsp page which is calling a servlet in form action. If it is till this, it is working fine and I could see the text printed in the servlet. However, if I am using RequestDispatcher to navigate again to another jsp page from servlets, it is only showing the jsp page contents and not showing the text printed thru servlet program.
What should I do so that it waits on servlet's output page for some time and then navigates to jsp page?
I tried Thread.sleep but that is not working.
"it is only showing the jsp page contents and not showing the text printed thru servlet program. " . Do you mean you are not able to retrive the values in the JSP file after forwarding from the servlet ?.
If you want to set some value from the servlet and pass it on the JSP page, you can use the request object.
I guess you are using PrintWrier object (out) as out.println("") to print some text on JSP and also using RequestDispatcher object to forward the request to JSP. If this is the case then your out.println("") code will not work.
Oracle Java Web Service Developer (1z0-897), Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I, CIW Certified Ecommerce specialist