• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Thread.sleep not working in a servlet

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi,

I have one servlet where I have called Thread.sleep(5000) in order to display the page for 5 seconds after that I have called sendredirect to a jsp page.
But the problem is that the redirect is working fine but the servlet is not being paused for 5 second.Please help.

Regards,
Arka
 
Bartender
Posts: 4101
63
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that you can't do both (display a page which essentially sending a response & redirect) at the same time in a servlet.
 
Arka Sharma
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


How to do it otherwise ? What I want is that the outputp of servlet will be displayed for a while then it will be automatically redirect to some other page
 
Marshal
Posts: 67275
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to do that with JavaScript on the client, or via an HTML meta tag.
 
Vijitha Kumara
Bartender
Posts: 4101
63
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An example here.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!