show processing image

I need to show the processing image before the layout is rendered.When the jsp is called from action it takes few seconds at that time panels are not created and a blank white screen is being displayed. need to show processing images,how to achieve this

the dilemma is that the JavaScript GUI page display will be suspended until the page is completely loaded.
Therefore you have to separate the two actions: showing the Wait message/image(animated gif) and second step: producing the page output.
Doing that two tasks in a single page is tricky and therefore do it in two Responses to the page request.
Like this:

Instead of reloading the same page after wait is done you can also redirect to some other worker page and use upper page only for Wait message display.
For that change the URL in response.setHeader("Refresh", "1; URL=some.jsp"); to some worker page.

So the solution to a slow loading page is to add more overhead to tell the user that the page is slow?

Why deal with the real problem which is the slow load. Bring in a barebones skelton of the page and then use ajax in the background after the load instead of making the user wait while you do all the frontend stuff. If the page is that slow, then putting up something to tell the user you are processing is not going change the normal behavior which sees a rapid increase in the use of the back button after about 3 seconds of wait time.

<?php // demo/temp_rocking_server.phperror_reporting(E_ALL);// SEE http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28481473.html// THIS SCRIPT WAITS A WHILE BEFORE PRODUCING ITS OUTPUT, SIMULATING A LONG-RUNNING TASKsleep(5);echo 'Here is the output from the server-side AJAX script.';

@Rocking: sorry I did not notice your response to me among all the other comments.

First: the one second is not a parameter at all. The following page will start showing first when output of second response is flushed to browser and not at the beginning of second response transmit. That means when the second response takes 15 seconds then the redirect after one second shows 16 seconds the first response with the Wait image.

And then: if you need a refresh of the page and need to display the wait image again after the Query parameter "&wait=done" was added then you need logic for doing so and change the QueryString parameters accordingly.

i understood if the page takes 10 seconds to load the wait message is displayed for 10 seconds ,if 2 seconds to load then wait will be displayed for 2 seconds.this is dynamic

if you need a refresh of the page and need to display the wait image again after the Query parameter "&wait=done" was added then you need logic for doing so and change the QueryString parameters accordingly.

working with ajax is easy to show the loading images? what i wanted to know is the solution provided by an expert above,can u please help me out in in the queries below
i understood if the page takes 10 seconds to load the wait message is displayed for 10 seconds ,if 2 seconds to load then wait will be displayed for 2 seconds.this is dynamic

if you need a refresh of the page and need to display the wait image again after the Query parameter "&wait=done" was added then you need logic for doing so and change the QueryString parameters accordingly.

You're making this too complicated... go back to what Ray said here: http:#a40230272. You have a simple html page with nothing but a wait message. the jsp page is then loaded from javascript (ajax) and inserted into the webpage.

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …

Viewers will learn one way to get user input in Java.
Introduce the Scanner object:
Declare the variable that stores the user input:
An example prompting the user for input:
Methods you need to invoke in order to properly get user input: