• 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Re: Servlet Redirect with time delay  RSS feed

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
When a servlet is called (says, servlet A), and I want to redirect to another html file or servlet file, I will use response.sendRedirect("URL"). However, what I want now is I want to display a page (says, Page B)giving some message to users and redirect with time delay, says, 3 seconds, to another page (says, Page C) for other actions. What should I do in servlet A to achieve the purpose. Page A and Page B can be html files or codes generated by servlet.
Regards,
Joe
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following can be used. This example will load google after 10 seconds.
response.setHeader("Refresh", "10; URL=http://www.google.com")
 
Ranch Hand
Posts: 162
1
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bosun Bello wrote:The following can be used. This example will load google after 10 seconds.
response.setHeader("Refresh", "10; URL=http://www.google.com")




What is the meaning of "Refresh" here ? Is there any constant defined for the same in API.

Thanks
 
Marshal
Posts: 67197
169
IntelliJ IDE Java jQuery Mac Mac OS X
 
Saloon Keeper
Posts: 2270
290
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the reason for the delay?
  • To make the user is aware that they are being redirected (to another site)?
  • To allow the user's browser back button to continue to work (and not be immediately redirected back again)?
  • To give enough time for dynamic context to be available at the redirected location?

  •  
    I will open the floodgates of his own worst nightmare! All in a tiny ad:
    RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
    https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!