<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'dynamictable.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <% String[] stuname={"张振强","王瑞妙","妙仔"}; %> <table border="1" align="center"> <tr> <td align="center"> 编号 </td> <td align="center"> 姓名 </td> </tr> <% for(int i=0;i<stuname.length;i++){ %> <tr> <td align="center"><%=i+1 %></td> <td align="center"><%=stuname[i] %></td> </tr> <%} %> </table> </body> </html>