引用了jquery-1.3.2.js包
<%@ 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 'MyJsp.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">
<script type="text/javascript" src="script/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
getInfo();
setInterval(getInfo, 1000)
});
function getInfo(){
var dt = new Date();
y = dt.getFullYear();
m = dt.getMonth()+1;
d = dt.getDate();
h = dt.getHours();
n = dt.getMinutes();
p = dt.getSeconds();
m = m<10?'0'+m:m;
d = d<10?'0'+d:d;
h = h<10?'0'+h:h;
n = n<10?'0'+n:n;
p = p<10?'0'+p:p;
s = y + "-" + m + "-" + d + " " + h + ":" + n + ":" + p;
$("#dat").html(s);
}
</script>
</head>
<body>
<div id="dat"></div>
</body>
</html>