当前位置:编程学习 > JSP >>

【web】http长连接技术(3)http push的jsp实现

   标签:web  push jsp

push-html-stream.jsp
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <meta http-equiv="Pragma" content="no-cache">
</HEAD>
<BODY BGCOLOR="blue" TEXT="white">
<%
  try {
    for (int i=1; i < 10; i++) {
       out.print("<h1>"+i+"</h1>");
       out.flush();
     
       try {
            Thread.sleep(3000);
       } catch (InterruptedException e) {
            out.print("<h1>"+e+"</h1>");
       }
     }
   } catch (Exception e) {
       out.print("<h1>"+e+"</h1>");
   }
   out.print("<h1>DONE</h1>");

%>
</BODY>
</HTML>

<
补充:Jsp教程,Java基础
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,