I've got a jsf page getting a request scope bean. A sluggish database totally fired within the constructor from the request scope bean. Then, the outcomes from the query are proven inside a jsf data table on the internet page.

How do you display a wait message before the database query completes?

I attempted calling a javascript function for onLoad of tag. The technique is known as only following the slow db query executes.

The slow database totally happening around the server, lengthy prior to the built page ever causes it to be to the browser. The only method to do what you would like would be to request the browser to show the "Wait" message before you initiate the HTTP request that leads to your JSF page being run.

Most likely the easiest method to spend time about this, however, would be to fix the query.

You have to load the "wait page" first after which, within the onLoad of this page, load one which does the DB query. When the totally fast, the consumer will not see much flickering because modern browsers (= not IE6).

Alternatively, you are able to load the create a hidden iframe and show a "please wait" within the page. Once the code within the iframe has loaded, you may make it visible by being able to access parents document with parent:

parent.getElementById('frame').styles.display = '';
parent.getElementById('wait').styles.display = 'none';

(put this within the onLoad from the JSP that is within the iframe).