JSP第二次

利用Java程序片,用for二重循环输出一个3行5列的table

 1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
 2 <%
 3     String path = request.getContextPath();
 4     String basePath = request.getScheme() + "://"
 5             + request.getServerName() + ":" + request.getServerPort()
 6             + path + "/";
 7 %>
 8 
 9 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
10 <html>
11 <head>
12 <base href="<%=basePath%>">
13 
14 <title>My JSP 'index.jsp' starting page</title>
15 <meta http-equiv="pragma" content="no-cache">
16 <meta http-equiv="cache-control" content="no-cache">
17 <meta http-equiv="expires" content="0">
18 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
19 <meta http-equiv="description" content="This is my page">
20 <!--
21     <link rel="stylesheet" type="text/css" href="styles.css">
22     -->
23 </head>
24 
25 <body>
26     <%--利用Java程序片,用for二重循环输出一个3行5列的table--%>
27     <%!int i, j;%>
28     <table border="1" width="30" height="30" bordercolor=black>
29         <%
30             for (i = 1; i <= 3; i++) {
31         %>
32         <tr>
33             <%
34                 for (j = 1; j <= 5; j++) {
35             %>
36             <td>table:我是一个标题</td>
37             <%
38                 }
39             %>
40         </tr>
41         <%
42             }
43         %>
44     </table>
45 </body>
46 </html>

 

 

posted @ 2021-03-10 19:02  潘宇航  阅读(49)  评论(0编辑  收藏  举报