Implementing "Please wait..." page

Discussions

Web tier: servlets, JSP, Web frameworks: Implementing "Please wait..." page

  1. Implementing "Please wait..." page (1 messages)

    I have a Struts like framework on the web .
    Here's the scenario :
    Page1 contains a form which when the user submits, persists data into the DB and then forwards to Page2. Page2 takes considerable time to load since it retrieves lot of its content from the DB.
    How can I implement something where once the user submits form on Page1, a "Please wait..." screen loads up and then as soon as Page2 is ready it forwards to Page2?
  2. Here's a quick and easy method:

    Create a JSP page called, for example, <loading.jsp>. When you know you are going to direct the user to a slow page, actually direct them to <loading.jsp?URL=/webapp/mySlowPage.jsp>. The jsp page displays the "Please wait..." message and then sets a header which will load the real page. While the browser is waiting for a response from the slow loading page it will display the message on the loading page.

    Here's an example where and animated gif is used for the "Please wait..." message.

    <HTML>
    <HEAD>
    <META HTTP-EQUIV="REFRESH" CONTENT="1;URL=<%= URL_from_querystring %>">
    </HEAD>
    <BODY BGCOLOR="white">
    <IMG SRC="../images/loadinganimation.gif">
    </BODY>
    </HTML>