We help IT Professionals succeed at work.

redirect.....after sometime

Jagadeesh M
Jagadeesh M asked
on
Medium Priority
246 Views
Last Modified: 2010-03-31
Hi,

My question is regarding the redirection.

I've a confirmation jsp page which is forwarded from a servlet. Once the confirmation page shows up...i need that page to redirect to login page say after 10 seconds....how can i accomplish this using java/jsp.


thank you.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016
Commented:
Get it to write the meta tag to the page

http://webmaster.iu.edu/tool_guide_info/refresh_metatag.shtml

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Mayank SPrincipal Technologist
CERTIFIED EXPERT
Commented:
Not sure if meta is supported the same way on all browsers:

http://www.utoronto.ca/webdocs/HTMLdocs/NewHTML/meta.html

I prefer this in Javascript:

setTimeout ( "redirect ()", 10000 ) ;

function redirect ()
{
  window.location.replace ( "new URL" ) ;
}
CERTIFIED EXPERT
Top Expert 2016

Commented:
But JavaScript may not be enabled ;-)
Mayank SPrincipal Technologist
CERTIFIED EXPERT

Commented:
He he, CEHJ, I knew you'd say that ;-) but if it is enabled, I hope it works the same way on all browsers as long as the version is the same.
CERTIFIED EXPERT
Top Expert 2004
Commented:
So the obvious solution is to do both ;-)

Do a META for 10 seconds, Javascript for 11 seconds, and add a link to the page for the user to click if neither is enabled ;-)

Tim
Jagadeesh MBig Data and Splunk Architect

Author

Commented:
so if i go for javascript option....do i need to just specify that in the script tags...thatz it for something else...?
Mayank SPrincipal Technologist
CERTIFIED EXPERT

Commented:
Yes.

<script language = "javascript" type = "text/javascript" >

write the functions here

</script>

Set one of the functions as the handler for your body's onload event.
Mayank SPrincipal Technologist
CERTIFIED EXPERT

Commented:
>> Set one of the functions as the handler for your body's onload event.

In that one, you need to do: >> setTimeout ( "redirect ()", 10000 ) ;
CERTIFIED EXPERT
Top Expert 2004

Commented:
it should be said though, that every browser (including WebTV) that I have had to use has accepted the META tag...  though not every browser has done javascript...
Mayank SPrincipal Technologist
CERTIFIED EXPERT

Commented:
You're sure they handle it in the same manner (meaning http-equiv, url etc attributes don't change)?
CERTIFIED EXPERT
Top Expert 2004

Commented:
as far as I have seen, yes...

I am sure there are some browsers that do not support it though, which is why a link should also be provided...
CERTIFIED EXPERT
Top Expert 2004

Commented:
(I haven't tested anything on WebTV for a good 5 years or so it should be noted) ;-)

They might now support javascript...
CERTIFIED EXPERT
Top Expert 2016

Commented:
:-)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.