This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to navigate from jsp-to servlets-and again to another -jsp

 
Kv Payal
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 80
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Pie
Posts: 20380
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our servlets forum.
 
Abhay Agarwal
Ranch Hand
Posts: 1375
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Punya Pratap Singh
Ranch Hand
Posts: 81
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your servlet should not be emitting any output, that's the job of the JSP.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic