This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to display a Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to display a "wait... loading" message while the servlet is loading the other page?" Watch "How to display a "wait... loading" message while the servlet is loading the other page?" New topic
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: 689
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: 61092
    
  66

Not much to do with Servlets, so moving to the HTML forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

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: 689
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: 88
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to display a "wait... loading" message while the servlet is loading the other page?