jsp页面的基本构成
2013-04-23 22:15
197 查看
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <%@ page import="java.util.Date"%> <%@ page import="java.text.SimpleDateFormat"%> 指令标识 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title>一个简单的JSP页面——显示系统时间</title> </head> html代码 <body> <% Date date = new Date(); //获取日期对象 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //设置日期时间格式 String today = df.format(date); //获取当前系统日期 %> 嵌入的java代码 当前时间:<%=today%> <!-- 输出系统时间 --> html注释 </body> </html>