| Author |
How to display a "wait... loading" message while the servlet is loading the other page?
|
Rogerio Kioshi
Ranch Hand
Joined: Apr 12, 2005
Posts: 654
|
|
Hi,
I have a Servlet which performs a login task, but it takes some time to load because it uses a webservice that it is not very fast.
So, I'd like to display to the user a message saying "Please wait a little bit". How could I do that?
|
SCEA 5 (part 1), SCBCD, SCWCD, SCJP, CLP, CLS
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56153
|
|
|
Not much to do with Servlets, so moving to the HTML forum.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56153
|
|
|
Have ypu tried simply displaying a notice using a submit handler before the form is submitted?
|
 |
Rogerio Kioshi
Ranch Hand
Joined: Apr 12, 2005
Posts: 654
|
|
Bear Bibeault wrote:Have ypu tried simply displaying a notice using a submit handler before the form is submitted?
How?
Now I've been trying this: http://malsup.com/jquery/block/#page
|
 |
Hikari Shidou
Ranch Hand
Joined: Jan 22, 2013
Posts: 79
|
|
JavaScript is the way to go, Servlet is server-side you know.
As long as I know, once browser submits a request we can't control what happens until next page is loaded.
So, either you handle lag before loading the new page, or you handle lag after page is loaded. Of course, it's hard to load a page that requires authentication, before authentication is done, so better keep on login page until it happens.
My suggestion is that you handle login with AJAX, always being careful with security. Instead of letting browser submit the form, your JS gathers login information and asynchronously sends to Servlet using AJAX. I don't know how to do it but it can be done.
While your JS wait for response, you create some animation to distract user. Once responce comes, if it login succeeds, your JS loads the new page.
|
 |
sonia caasi
Greenhorn
Joined: Jan 31, 2013
Posts: 2
|
|
|
yuah, javascript i guess is the one way to do your task, this is a tutorial site. hope it can help
|
 |
 |
|
|
subject: How to display a "wait... loading" message while the servlet is loading the other page?
|
|
|