<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.util.Date"%>
<html>
<head>
<title>定时刷新页面</title>
</head>
<body>
<%//设置刷新页面的时间,第隔1秒钟刷新一次
response.setHeader("refresh","1");
%>
当前的系统时间是:
<%//输出当前最新的时间
Date thisDay=new Date();
out.print((thisDay.getYear()+1900)+"年");
out.print((thisDay.getMonth()+1)+"月");
out.print(thisDay.getDate()+"日");
out.print(thisDay.getHours()+"时");
out.print(thisDay.getMinutes()+"分");
out.print(thisDay.getSeconds()+"秒");
out.print("星期");
switch(thisDay.getDay())
{
case 0:
out.print("日");
break;
case 1:
out.print("一");
break;
case 2:
out.print("二");
break;
case 3:
out.print("三");
break;
case 4:
out.print("四");
break;
case 5:
out.print("五");
break;
case 6:
out.print("六");
}
%>
</body>
</html>
简单的定时刷新页面(jsp)
最新推荐文章于 2024-05-21 16:13:06 发布