• 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

how to set loading message until data display

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

when i call the servlet, it is taking time for load the data. until that i wanted to give the loading message in that page.

for that what should i do?..
 
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
First I would try to see why it's taking so long and see if it can be sped up.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One way to do it (besides trying not to take too long on this kind of processes) is calling another page/servlet/jsp that will in turn call your heavy load servlet and display appropiate feedback to the user.

Here is how.
Lets asume right now you have 1 page and a servlet.
Page 1: form page (with a button to:)
ProcessHeavyStuffServlet (our slow servlet)

We have to change this by adding a couple of things. like this:

Page 1. Form page (user fills stuff and clicks next which is the heavy load stuff)
We replace the ProcessHeavyStuffServlet link with a link to a waiting page.
Page 2. Waiting page (new page)
Here we have a waiting image and we call the ProcessHeavyStuffServlet using AJAX or an IFRAME (i know they are ugly but sometimes useful)
ProcessHeavyStuffServlet
We modify this one to store some data in the session (like the results of the execution) at the end of the execution it will tell the waiting page (using AJAX or in the IFRAME using a parent call) to go to:
page 3. Results page (new page)
We get the data that ProcessHeavyStuffServlet stored in the session and display it.

This is the theory behind those beautiful and annoying "please wait" sliders and gizmos.

Hope this helps, good luck, have fun.
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish 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