jsp自定义行数 表格填充

来源:互联网 发布:新手可以做淘宝代销吗 编辑:程序博客网 时间:2024/06/13 21:32
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%><%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 'index.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 color;  String[] colorbar={"red","green","blue","yellow","black","lightblue"};  for(int i=1;i<=10;i++)  {         %>  <p style= "color:<%=colorbar[i%6] %>;font-size:<%=i*5 %>px;">hello world </p>  <%  }   %>        <% String  colStr= request.getParameter("cols");  int cols;  try{  cols =Integer.parseInt(colStr);}  catch(Exception e){cols=3;  }   %>      <table border=1>  <%  int x=0;  for(int z=0;z<cols;z++)  {   %>   <tr>   <%   for(int j=0;j<7;j++)   {   x++;    %>              <td><%=x %></td> <%   }%>    </tr>    <%   }     %>       </table>  </body></html>

原创粉丝点击