JSP基础实例_Java动态实现课程表_学习笔记

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/tianmaxingkong_/article/details/46733555



classTable.jsp

<center><strong>课程表</strong></center>
  <%
  String[] head = {"星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"};
  String[] left = {"上午","下午","晚上"};
  String classInfo[][] = {
  {"语文","化学","生物","物理","科学","政治","历史"},
  {"体育","英语","自习","韩语","自习","体育","数学"},
  {"体育","生物","美术","体育","自习","历史","物理"}
  };

  %>

<table width="500" height="230" border="1" align="center">

  <%
  for(int i = 0; i < 4;i++)
  {
  out.print("<tr>");
  for(int j=0; j < 8; j++)
  {
  if( i == 0)
  {
  if( j == 0)
  {
  out.print("<td><center><strong>星期/时间</strong></center></td>");
  }else{
  out.print("<td><center>" + head[j - 1] + "</center></td>");
  }
  }else{
  if( j == 0)
  {
  out.print("<td><center>" + left[i - 1] + "</center></td>");
  }else{
  out.print("<td><center>" + classInfo[i - 1][ j - 1] + "</center></td>");
  }
  }
  }
  out.print("</tr>");
  }
  %>
  </table>
阅读更多
换一批

没有更多推荐了,返回首页