如题~~

解决方案 »

  1.   

    页面进行长时间请求时显示等待页面,当请求完毕时等待页面自动被替换<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        <title>My JSP 'querycondition.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
      <script type="text/javascript">
       function check(){
       pleaseWait();
       document.all.form1.submit();
       }
      </script>
      </head>
      
      <body>
      <!-- 等待画面 -->
       <jsp:include page="wait.jsp" />
       <form name="form1" action="xx.do" method="post">
       查询条件:<input type="text" name="condition"><br>
       <input type="button" name="query" value="query" onclick="check();"><br> 
       </form>
      </body>
    </html>
    wait.jsp<%@ page language="java" pageEncoding="UTF-8"%>
    <script language="JavaScript">function pleaseWait()
    {
       sending.style.visibility="visible";
       cover.style.visibility="visible";
    }
    </script><div id="sending" style="position:absolute; top:270; left:20; z-index:10; visibility:hidden">
      <TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
        <TR>
      <td width=30%></td>
      <TD bgcolor=#C6D7FF>
        <TABLE WIDTH=100% height=70 BORDER=0 CELLSPACING=2 CELLPADDING=0>
      <TR>
        <td bgcolor=#eeeeee align=center><font color="blue"  size="4">正在执行中,请稍候</font>&nbsp;<img align="middle"  src="images/pleasewait2.gif" border="0" /></td>
      </tr>
    </table>
      </td>
      <td width=30%></td>
    </tr>
      </table>
    </div>
    <div id="cover" style="position:absolute; top:0; left:0; z-index:9; visibility:hidden">
      <TABLE WIDTH=100% height=900 BORDER=0 CELLSPACING=0 CELLPADDING=0>
        <TR>
      <TD align=center><br></td>
    </tr>
      </table>
    </div>