• 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

"wait" effect in Java or JSP

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys,

I'm really new to JSP, and I just started coding a password login page for a website at work.

What I'd like it to do is display something like "sorry, invalid username/password" for a couple of seconds, then automatically forward back to the login screen.

Anyone care to tell me how that's achieved (either through HTML or Java, doesn't matter to me)

Thanks a bunch!
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do that with the refresh header:
http://en.wikipedia.org/wiki/URL_redirection#Refresh_Meta_tag_and_HTTP_refresh_header

Putting this in the JSP should do it:
<meta http-equiv="refresh" content="2;url=http://mysite/mylogin.jsp">

The number before the semicolon specifies the delay(in seconds) before it goes to the url after the semicolon.
This is commonly used with download sites. the ones that say "your download should start in a few seconds. If it doesn't then click here..."


However, a more user friendly approach might be to go straight back to the login page, display an error message there, and give the user the chance to try again immediately. Without having to load another page.

Cheers,
evnafets
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sort of thing is best done with client side code.
Moving to our HTML/Javascript forum.
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic