3.10jsp

作业∶利用Java程序片,用for二重循环输出一个3行5列的table考察JSP程序片和HTML代码结合

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<style>
table{
width: 200px;
height:200px;
text-align: center;
}
</style>
</head>

<body>
<table border = "1" cellspacing="0" cellpadding="0">
<%
for(int i =0;i<3;i++){
out.print("<tr>");
for(int j =0;j<5;j++){
out.print("<td>"+j+"</td>");
}
out.print("</tr>");
}
%>
</table> 
</body>
</html>
 

原文地址:https://www.cnblogs.com/zjzj123/p/14509980.html