简单的JSP:显示当前时间
<%
Date date = new Date(); //获取日期对象
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //设置日期时间格式
String today = df.format(date); //获取当前系统日期
%>
当前时间:<%=today%> <!-- 输出系统时间 -->
JSP的指令标识格式:<%@ 指令名 属性1="属性值1" 属性2="属性值2"..... %>
page指令是 最常用的 格式是:<%@ page attr="value1" ....%>
page 属性有:extends language import pageEccoding(编码) contenttype(设置类型和字符编码) session(会话对象,内置对象,是boolean类型 true 和false)
buffer(缓冲区大小,默认8KB)autoflush(存满是否自动刷新) isErrorpage (异常处理,当前设置成错误处理页面来处理另一个JSP页面的错误) errorPage(URL字符串)
include(文件包含指令):格式是<%@ include file="path"%>
例如:<%@ page pageEncoding="UTF-8"%>
<img src="C:\Users\Administrator\Desktop\banner.JPG">
<%
String copyright=" All Copyright © 2009 吉林省明日科技有限公司";
%>
<table width="778" height="61" border="0" cellpadding="0" cellspacing="0" background="C:\Users\Administrator\Desktop\banner.JPG">
<tr>
<td> <%= copyright %></td>
</tr>
<body style="margin:0px;">
<%@ include file="top.jsp"%>
<table width="781" height="279" border="0" cellpadding="0" cellspacing="0" background="C:\Users\Administrator\Desktop\banner.JPG">
<tr>
<td> </td>
</tr>
</table>
<%@ include file="copyright.jsp"%>
taglib(引用标签库中的标签) 格式:<%@ taglib prefix="vdsh "URL="vdsv"%>(prefix前缀)