| Author |
How to navigate from jsp-to servlets-and again to another -jsp
|
Kv Payal
Greenhorn
Joined: Apr 17, 2011
Posts: 11
|
|
Hi,
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.
Please help.
Thanks
|
 |
Santhosh ayiappan
Ranch Hand
Joined: Jan 30, 2007
Posts: 70
|
|
"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.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Moving to our servlets forum.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Abhay Agarwal
Ranch Hand
Joined: Feb 29, 2008
Posts: 693
|
|
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.
~ abhay
|
Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I
|
 |
Punya Pratap Singh
Ranch Hand
Joined: Nov 23, 2010
Posts: 74
|
|
|
I am not printing any response.I am just creating a xml file.which is being created but not containing the desired result as I mentioned above in issue.
|
 |
Jeff Ishar
Greenhorn
Joined: Jul 04, 2011
Posts: 13
|
|
Can you please either put the code here or clear precise steps you are trying to achieve your goal with ? Your objective is unclear.
Cheers
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56180
|
|
|
Your servlet should not be emitting any output, that's the job of the JSP.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: How to navigate from jsp-to servlets-and again to another -jsp
|
|
|