标签:
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 4 <%@ page import="java.util.Date" %> 5 <%@ page import="java.text.SimpleDateFormat" %> 6 7 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 8 <html> 9 <head> 10 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 11 <title>Insert title here</title> 12 </head> 13 <body> 14 15 <% 16 17 // 声明和实例化了Date对象,获取系统时间 18 19 // 在页面上显示当前时间 20 // 声明和实例化了一个Date对象 21 Date date = new Date(); 22 // 格式化日期 23 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 24 25 String dt = sdf.format(date); 26 27 %> 28 29 输出当前时间:<%=dt %> 30 31 <br> 32 33 显示汉字!!! 34 35 </body> 36 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8" isErrorPage="true"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7 <title>Insert title here</title> 8 </head> 9 <body> 10 页面出错了! 11 </body> 12 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8" errorPage="error.jsp"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7 <title>Insert title here</title> 8 </head> 9 <body> 10 网页正文 11 <br> 12 <br> 13 <%@ 14 include file="include.jsp" 15 %> 16 17 </body> 18 </html>
标签:
原文地址:http://www.cnblogs.com/zxw0004/p/4979219.html