Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

dispatching req from one servlet to another

 
mahend pachpor
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once We get a request form client ie html to first servlet

Servlet should wait for some time and then dispatch the request to another servlet or client

I had tried this by creating a thread in the servlet and by using sleep method I tried to delay the despatching but it is not happing
It directly dispatches to another servlet and gives the output

So please help me..
 
Arvind Giri
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I didn't get why are you creating a new thread and then calling sleep. I think a direct call to Thread.sleep inside your service methods(doGet,doPost,...) should do the job.

Still, it would be more helpful for us if we get to have a look at that piece of code....
 
Boobalan Pillai
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You dont need to write any thread code.you can use the following code instead

response.addHeader("REFRESH","5;url=/webapps/root/index.html/");

This will wait for 5 seconds then display the index.html

Regards
Bala.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!