日期:2014-05-17  浏览次数:20787 次

如何在JSP中 即时在网页上更新数据中更新的数据,在线等~~
我的源码如下。
usermanger.jsp
<%@ page language="java"%>
<%@ page import="java.sql.*"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
  response.setHeader("Cache-Control", "no-cache, no-store"); //HTTP 1.1  
  response.setHeader("Pragma", "no-cache"); //HTTP 1.0  
  response.setDateHeader("Expires", 0); //prevents caching at the proxy server  
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV= "pragma" CONTENT= "no-cache ">  
<META HTTP-EQUIV= "Cache-Control" CONTENT= "no-cache, must-revalidate ">  
<META HTTP-EQUIV= "expires" CONTENT= "0 "> 
<title>管理员管理</title>
<link href="css/Style.css" rel="stylesheet" type="text/css">
<script language=javascript>
function checkdel()
{
if(confirm("你确定要删除该管理员吗?一旦删除,将不能恢复!"))
return true;
else
return false;
}
</script>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body style="width:100%;">

<jsp:useBean id="connDBBean1" scope="page" class="Conn.conn"/> 
  <%
ResultSet rs=connDBBean1.executeQuery("select * from denglu");%>
<br>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" style="border: 2px solid #ffffff;" class="border">
  <tr align="center" class="sec_menu">
  <td width="9%" class="tbbgtitle">ID</td>
  <td width="20%" class="tbbgtitle">账号</td>
  <td width="19%" class="tbbgtitle">姓名</td>
  <td width="15%" class="tbbgtitle">最后登录IP</td>
  <td width="19%" class="tbbgtitle">最后登录时间</td>
  <td width="18%" class="tbbgtitle">操作</td>
  </tr>
  <%
  while(rs.next()){
  %>
  <tr align="center" class="lineheight" onMouseOver="this.style.background='#F8F8F8';this.style.cursor='hand';" onMouseOut="this.style.background='';this.style.cursor='default';">
  <%
  String m=rs.getString(1);
  int i=Integer.parseInt(m);
  out.print("<td>"+i+"</td>");
  out.print("<td>"+rs.getString(2)+"</td>");
  out.print("<td>"+rs.getString(3)+"</td>");
  out.print("<td>"+rs.getString(4)+"</td>");
  out.print("<td>"+rs.getString(5)+"</td>");
  %>
  <td><a href="delete.jsp?id=<%=i%>" onclick="checkdel();">删除</a>
  <input name="admindel" type="hidden" id="admindel" value="del"></td>
  </tr>
  <%
  }%>
</table>
<table width="99%" border="0" align="center" cellpaddi