File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Server side redirect (301) - JSP :: How to set time delay before page redirect using Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Server side redirect (301) - JSP :: How to set time delay before page redirect using " Watch "Server side redirect (301) - JSP :: How to set time delay before page redirect using " New topic
Author

Server side redirect (301) - JSP :: How to set time delay before page redirect using

Suresh Gopi
Ranch Hand

Joined: Mar 08, 2007
Posts: 49
Hello Friends,

I want to show one page for 5 seconds and after that i want to redirect the page to another URL.

Got the code snippet for 301 redirection in JSP .

<%

response.setStatus(301);

response.setHeader( "Location", "http://www.new-url.com/" );

response.setHeader( "Connection", "close" );

%>


Please let me know how to set the time delay.

Is there any way to set the time delay using response.setHeader() method.

Note: I checked the possible HTTP response headers but couldn't find one to acheive this.

The above can be acheived using meta tag or script language but i want to do it in server side.

Is it possible?


Regards<br />Suresh
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

i am not sure,but what about Thread.sleep(1000) in server side ?

correct me if i am wrong
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

Originally posted by seetharaman venkatasamy:
i am not sure,but what about Thread.sleep(1000) in server side ? correct me if i am wrong
Umm, no. Not a very good idea.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

Hint
Bennet Xavier
Ranch Hand

Joined: Jun 19, 2008
Posts: 162
Hi Bear Bibeault,

Thank You Very Much.

its really superb information.


Thanks And Regards

Bennet Xavier. X
Suresh Gopi
Ranch Hand

Joined: Mar 08, 2007
Posts: 49
Thanks a lot Bear Bibeault.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Thanks a lot Bear
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Server side redirect (301) - JSP :: How to set time delay before page redirect using