Forums Register Login

Redirecting...

+Pie Number of slices to send: Send
Hello,
Is there a smart way to redirect to another page after a specific amount of time? (2 seconds for example).
Tom.
+Pie Number of slices to send: Send
Personally, I prefer to use good old JavaScript....
<HTML>
<HEAD>
</HEAD>
<SCRIPT>
<!-- START HIDE
function jmp(){
document.location.href="http://www.Yahoo.com/"
}
// STOP HIDE -->
</SCRIPT>
<BODY onload="setTimeout('jmp()',2000)">
</BODY>
</HTML>
That's set for 2 seconds
------------------
C programmer gone astray
+Pie Number of slices to send: Send
Yes, you can. You need to set it in the response.setHeader()
Here is an example that loads the Google page after 20 seconds.
response.setHeader("Refresh", "20; URL=http://www.google.com")

Bosun
+Pie Number of slices to send: Send
Thanx for your answers.
The JavaScript stuff works fine but not for my case : the redirection link is not static but it is "calculated" inside a snippet (the page that contains the redirection does some kind of proccesseing and may be called from various pages. I want to redirect the user at the page he submitted the information). As soon as I know Javascript does not "see" Java variables declared in a JSP (the calculated link is a string). I tried the following :
response.setHeader("Refresh", "2; URL=" + myLink)
but the server said :
org.apache.jasper.JasperException: Unable to compile class for JSP response.setHeader("Refresh", "2; URL=" + pageLink)
Any further ideas?
Tom.

[This message has been edited by Tom Diamond (edited October 16, 2001).]
+Pie Number of slices to send: Send
Anyone with an idea???
+Pie Number of slices to send: Send
Tom, if this ("Refresh", "2; URL=" + pageLink) is the exact way you had it, you are missing a closing quote. It should be
("Refresh", "2; URL=" + pageLink")

Bosun
+Pie Number of slices to send: Send
actually...
("Refresh", "2; URL=\"" + pageLink + "\"")
isn't it?
Did Steve tell you that? Fuh - Steve. Just look at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 667 times.
Similar Threads
Redirect content to an external Page Flow
redirect ?
Debug logging on Sun Appserver vs. Tomcat
Redirecting of one frame to another frame
How to show recent blogs in my webpage
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:54:31.