• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

timer interval before jsp Forward ?

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there any way in jsp to wait say 3 secs before the jsp forward tag functions ?
thanks
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, you could always put the thread to sleep for 3 seconds. But that doesn't really sound like a happy thing to do.
What are you trying to accomplish by the wait?
bear
 
sarim raza
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can i make the thread to sleep ?
which thread ?
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thread.currentThread().sleep( 3000 ) should make the currently executing thread sleep for three seconds. However, I wouldn't recommend trying to manipulate threads that the application server is managing. It is highly frowned upon!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What James said. Not a great idea.
Why not clue us in on what you are trying to accomplish and maybe someone can suggest a happier way to get it done?
hth,
bear
 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just use following function of javascript for making some delay and sending to next page.
window.setTimeout("url", 2000);
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not possible to use Javascript at the server side.

Originally posted by Ali Hassaan:
just use following function of javascript for making some delay and sending to next page.
window.setTimeout("url", 2000);

 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think Ali's point is that if the original poster is trying to effect a delay on the client, that doing so on the client makes a lot more sense than stalling the server.
Without more information on what the original poster is trying to accomplish, it's difficult to come up with a reaasonable mechanism.
bear
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, since Sarim doesn't wanna share his scenario I will.
I'm using an intemediary page to tell the user that their password was changed successfully, before forwarding them to the action page. How do I pause i this intermediary page for a few seconds?
I tried something like this:

before doing this:

The redirect works but no pausing happens.
Thanks.
[ August 22, 2002: Message edited by: Med Shabe ]
[ August 22, 2002: Message edited by: Med Shabe ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Med, that is because your redirect is happening long before the javascript gets a chance to execute.
Remember that the java scriplets in your page execute on the server before the page gets sent to the client. Your redirect is causing the client to request the SelectData.jsp page before the page containing your javascript is even sent.
One way to effect what you are after is to have your intermediary page display a "working..." message while the setTimeout calls a javascript function that then loads the SelectData page. That way, the client is in control of the delay and when the next page gets loaded.
hth,
bear
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Med Shabe:
Well, since Sarim doesn't wanna share his scenario I will.
I'm using an intemediary page to tell the user that their password was changed successfully, before forwarding them to the action page. How do I pause i this intermediary page for a few seconds?
I tried something like this:

before doing this:

The redirect works but no pausing happens.
Thanks.
[ August 22, 2002: Message edited by: Med Shabe ]
[ August 22, 2002: Message edited by: Med Shabe ]


Are you looking to do something similar to what it does when you post to one of these topics? It brings up a page that says something like "thank you for posting, we are taking you back to blah blah blah." And, within a few seconds, it redirects you back to the topic you posted to. Is that what you want? Well, here's the code you'll need. You need to include something like this in your <head> section of your html page...
<meta http-equiv="refresh" content="5;http://www.yahoo.com">
This will forward to www.yahoo.com after 5 seconds. However, it's usually nice to place a link to the URL in case the user wants to jump right to it or doesn't feel like waiting 5 seconds (impatient users).
Hope this helps!
 
LOOK! OVER THERE! (yoink) your tiny ad is now my tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic