首页 > 代码库 > JSP 入门 HTML嵌套Java脚步 显示时间

JSP 入门 HTML嵌套Java脚步 显示时间

 

 1 <%@ page import="java.util.Date"%> 2 <%@ page language="java" contentType="text/html; charset=utf-8" 3     pageEncoding="utf-8"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 8 <title>Insert title here</title> 9 </head>10 <body>11     <h1>12         <%13             int s = new Date().getSeconds();14             out.println(new Date());15         %>16     </h1>17     <%--JSP注释 --%>18 19     <!-- HTML注释 -->20     <table border="1" align="center">21         <%22             while ((s--) > 0) {23         %>24         <tr bgcolor="<%=s % 2 == 0 ? "F0F00F" : "F0FFA0"%>">25             <td>姓名:<%=s%></td>26             <td><%=s%></td>27         </tr>28         <%29             }30         %>31     </table>32 </body>33 </html>

 

JSP 入门 HTML嵌套Java脚步 显示时间