得到日期:::用<%= (new java.util.Date()).toLocaleString()%>jsp:useBean动作最简单的语法为:
<jsp:useBean id="name" scope="..." />自动刷新实例
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %> <%@ page import="java.io.*,java.util.*" %> <html> <head> <title>菜鸟教程</title> </head> <body> <h2>自动刷新实例</h2> <% //设置时间刷新 response.setIntHeader("Refresh",5); //获取当前时间 Calendar calendar = new GregorianCalendar(); String am_pm; int hour = calendar.get(calendar.HOUR); int minute = calendar.get(calendar.MINUTE); int second = calendar.get(calendar.SECOND); if(calendar.get(Calendar.AM_PM)==0) am_pm = "AM"; else am_pm = "PM"; String CT = hour+":"+minute+":"+second+":"+am_pm; out.println("当前时间:"+CT+"\n"); %> </body> </html>
时间刷新
最新推荐文章于 2017-09-07 16:26:50 发布