main
<%@ page contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>登录系统</title>
</head>
    <form id="1" action ="denlv.jsp" method="get">   
   <p style="text-align:center;color:black;font-family:楷体; font-size:20px">    
                <br>
                身份:
                <select size ="1"name="calss">
                <option value ="学生" selected>学生</option>
                <option value ="教师" >教师</option>
                <option value ="管理员" >管理员</option>
                </select>
                <br><br>
                账号:             
                    <input type="text" name="num"size="15"/>
                <br><br>                
                密码:               
                    <input type="password" name="pass"size="16"/>                       
                <br><br>                  
                <br><br>            
                    <input type="submit" value="登录"/>
                    <input type="reset" value="重置"/>     
    </p>
    </form>  

</html>

denlu
<%@page import="aD.Ac"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>登录处理</title>
</head>
<body>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<% 
  String calss=(String)request.getParameter("calss");
  session.setAttribute("calss", calss);
  String num=(String)request.getParameter("num");
  session.setAttribute("num", num);
  String pass=(String)request.getParameter("pass");
  session.setAttribute("pass", pass);
  if(util.queryEmpty(num, pass)){
      out.print("<script language ='javaScript'> alert('输入不能为空');window.history.back(-1); </script>");
  }else if(util.inquiryNumber(num,calss)){
      out.print("<script language ='javaScript'> alert('未查询到改账号');window.history.back(-1); </script>");
  }else if(util.denlv(calss, num, pass)){
      out.print("<script language ='javaScript'> alert('密码错误');window.history.back(-1); </script>");
  }else{
      out.print("<script language='javaScript'> alert('登录成功');</script>");
      if(calss.equals("教师")){
          response.setHeader("refresh", "0;url=teacher.jsp");
      }else if(calss.equals("学生")){
          response.setHeader("refresh", "0;url=student.jsp");
      }else if(calss.equals("管理员")){
          response.setHeader("refresh", "0;url=contrul.jsp");
      }
      
  }
%>
</body>
</html>





<%@ page contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>教师系统</title>
</head>
      <p style="text-align:center;color:black;font-family:宋体,serif; font-size:20px">
                                        <a>管理员</a>   
            <br> 
            <br><br>
            <input type="button" value="添加教师" onclick="location.href='NewTeacher.jsp'" />
            <br><br>
            <input type="button" value="添加学生" onclick="location.href='addStudent.jsp'" />
            <br><br>
            <input type="button" value="登出" onclick="location.href='main.jsp'" />   
    </p>

</html>
<%@ page contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>教师系统</title>
</head>
      <p style="text-align:center;color:black;font-family:宋体,serif; font-size:20px">
                                        <a>管理员</a>   
            <br> 
            <br><br>
            <input type="button" value="添加教师" onclick="location.href='NewTeacher.jsp'" />
            <br><br>
            <input type="button" value="添加学生" onclick="location.href='addStudent.jsp'" />
            <br><br>
            <input type="button" value="登出" onclick="location.href='main.jsp'" />   
    </p>

</html>
<%@ page contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>添加教师</title>
</head>
<body>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<%
String calss="学生";
String num=(String)request.getParameter("num");
String name=(String)request.getParameter("name");
String sex=(String)request.getParameter("sex");
String banji=(String)request.getParameter("banji");
String zhuanye=(String)request.getParameter("zhuanye");
if(util.query(num)){
    out.print("<script language ='javaScript'> alert('输入不能为空');window.history.back(-1); </script>");
}else if(util.numCha(num)){
    out.print("<script language ='javaScript'> alert('学号必须为8位,且必须是数字');window.history.back(-1); </script>");
}else if(util.queryTeacherxiu(name, sex, banji, zhuanye)){
    out.print("<script language ='javaScript'> alert('输入不能为空');window.history.back(-1); </script>");
}else if(util.addStudentNum(num)){
    out.print("<script language ='javaScript'> alert('学号重复');window.history.back(-1); </script>");
}else{
    util.addStudent(calss, num, name, sex, banji, zhuanye);
    out.print("<script language='javaScript'> alert('添加成功');</script>");
    response.setHeader("refresh", "0;url=contrul.jsp");   
}
%>
</body>
</html>

<%@ page language="java" import="java.sql.*" pageEncoding="utf-8"%>
<html>
<head>
<title>添加教师</title>
</head>
<form id="1" action ="NewTeacherback.jsp" method="get">   
   <p style="text-align:center;color:black;font-family:楷体; font-size:20px">    
                <br>
                工号:             
                    <input type="text" name="num"size="15"/>
                <br><br>
                姓名:             
                    <input type="text" name="name"size="15"/>
                <br><br>
                性别:             
                    <input type="text" name="sex"size="15"/>
                <br><br>
                学院:             
                    <input type="text" name="yuan"size="15"/>
                <br><br>
                职称:
                <select size ="1"name="zhichen">
                <option value ="教授" selected>教授</option>
                <option value ="副教授">副教授</option>
                <option value ="讲师" >讲师</option>
                <option value ="助教" >助教</option>
                </select>              
                <br><br>                        
                <br><br>            
                <input type="button" value="返回上一页" onclick="javascript:history.back(-1)" /> 
                <br><br>
                    <input type="submit" value="确认"/>
                    <input type="reset" value="重置"/>     
    </p>
    </form>  
</html>
<%@ page contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>添加教师</title>
</head>
<body>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<%
String calss="教师";
String num=(String)request.getParameter("num");
String name=(String)request.getParameter("name");
String sex=(String)request.getParameter("sex");
String yuan=(String)request.getParameter("yuan");
String zhichen=(String)request.getParameter("zhichen");
if(util.query(num)){
    out.print("<script language ='javaScript'> alert('输入不能为空');window.history.back(-1); </script>");
}else if(util.numCha(num)){
    out.print("<script language ='javaScript'> alert('工号必须为8位,且必须是数字');window.history.back(-1); </script>");
}else if(util.queryTeacherxiu(name, sex, yuan, zhichen)){
    out.print("<script language ='javaScript'> alert('输入不能为空');window.history.back(-1); </script>");
}else if(util.addTeacherNum(num)){
    out.print("<script language ='javaScript'> alert('工号重复');window.history.back(-1); </script>");
}else{
    util.addTeaher(calss, num, name, sex, yuan, zhichen);
    out.print("<script language='javaScript'> alert('添加成功');</script>");
    response.setHeader("refresh", "0;url=contrul.jsp");   
}
%>
</body>
</html>
<%@ page contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>学生系统</title>
</head>
      <p style="text-align:center;color:black;font-family:宋体,serif; font-size:20px">
                                        <a>学生系统</a>   
            <br> 
            <br><br>
            <input type="button" value="修改个人信息" onclick="location.href='student-resive.jsp'" />
            <br><br>
            <input type="button" value="浏览课程" onclick="location.href='Swatch-c.jsp'" />
            <br><br>
            <input type="button" value="选课" onclick="location.href='xuanke.jsp'" />  
            <br><br>
            <input type="button" value="修改密码" onclick="location.href='sxiu.jsp'" />   
             <br><br>
            <input type="button" value="登出" onclick="location.href='main.jsp'" />   
    </p>

</html>
<%@ page language="java" import="java.sql.*" pageEncoding="utf-8"%>
<html>
<head>
<title>修改</title>
</head>
<body>
<table border="1"style="text-align:center">
<caption>学生信息</caption>
<tr>
<td align="center" width=3%>学号</td>
<td align="center" width=3%>姓名</td>
<td align="center" width=2%>性别</td>
<td align="center" width=2%>班级</td>
<td align="center" width=3%>专业</td>
</tr>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<%
String num=session.getAttribute("num").toString();
try{
    Connection connect = util.sjk();
    Statement stmt = connect.createStatement();
    ResultSet rs = stmt.executeQuery("select * from student");
    while(rs.next()){    
       if(num.equals(rs.getObject(2).toString()))
       {
           %>
          <tr>
          <td width=3% align="center"><%=rs.getObject(2) %></td>                
          <td width=3% align="center"><%=rs.getObject(3) %></td>        
          <td width=2% align="center"><%=rs.getObject(4) %></td>
          <td width=2% align="center"><%=rs.getObject(5) %></td>
          <td width=3% align="center"><%=rs.getObject(6) %></td>
          </tr>
            <%
       }
   }
   rs.close();
   connect.close();
   stmt.close();
}catch (SQLException e) {
   e.printStackTrace();            
}
%>
</table> 
</body>
<form id="1" action ="student-resiveback.jsp" method="get">   
   <p style="text-align:center;color:black;font-family:楷体; font-size:20px">    
                <br>
                姓名:             
                    <input type="text" name="name"size="15"/>
                <br><br>
                性别:             
                    <input type="text" name="sex"size="15"/>
                <br><br>
                班级:             
                    <input type="text" name="banji"size="15"/>
                <br><br>
                专业:
                    <input type="text" name="zhuanye"size="15"/>   
                <br><br>                        
                <br><br>            
                <input type="button" value="返回上一页" onclick="javascript:history.back(-1)" /> 
                <br><br>
                    <input type="submit" value="修改"/>
                    <input type="reset" value="重置"/>     
    </p>
    </form>  
</html>
<%@ page contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>修改信息</title>
</head>
<body>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<%

String calss=session.getAttribute("calss").toString();
String num=session.getAttribute("num").toString();
String name=(String)request.getParameter("name");
String sex=(String)request.getParameter("sex");
String yuan=(String)request.getParameter("banji");
String zhichen=(String)request.getParameter("zhuanye");
String num1=num;
if(util.queryTeacherxiu(name, sex, yuan, zhichen)){
      out.print("<script language ='javaScript'> alert('输入不能为空');window.history.back(-1); </script>");
}else{
    util.studentXiugai(calss, num, name, sex, yuan, zhichen, num1);
    out.print("<script language='javaScript'> alert('修改成功');</script>");
    response.setHeader("refresh", "0;url=student.jsp");   
}
%>
</body>
</html>
<%@ page language="java" import="java.sql.*" pageEncoding="utf-8"%>
<html>
<head>
<title>浏览</title>
</head>
<body>
<table border="1"style="text-align:center">
<caption>课程信息</caption>
<tr>
<td align="center" width=3%>课程编号</td>
<td align="center" width=3%>课程名字</td>
<td align="center" width=3%>教师</td>
</tr>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<%
try{
    
    Connection connect = util.sjk();
    Statement stmt = connect.createStatement();
    ResultSet rs = stmt.executeQuery("select * from classim");
    while(rs.next()){    
         %>
          <tr>
          <td width=3% align="center"><%=rs.getObject(1) %></td>
          <td width=3% align="center"><a style="color:blue" href='classKan.jsp?id=<%=rs.getObject(1) %>'><%=rs.getObject(2)%></a></td>
          <td width=3% align="center"><a style="color:blue" href='teacherKan.jsp?id=<%=rs.getObject(6) %>'><%=rs.getObject(4)%></a></td>                        
          </tr>
           <%
   }
   rs.close();
   connect.close();
   stmt.close();
}catch (SQLException e) {
   e.printStackTrace();            
}
%>
</table> 
</body>   
   <p style="text-align:center;color:black;font-family:楷体; font-size:20px">                           
                <br><br>            
                <input type="button" value="返回上一页" onclick="javascript:history.back(-1)" /> 
   
    </p>
</html>
<%@ page language="java" import="java.sql.*" pageEncoding="utf-8"%>
<html>
<head>
<title>修改</title>
</head>
<body>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<form id="1" action ="sxiuback.jsp" method="get">   
   <p style="text-align:center;color:black;font-family:楷体; font-size:20px">    
                <br>
                输入旧密码:             
                    <input type="text" name="jiu"size="15"/>
                <br><br>
                输入新密码:
                    <input type="text" name="xin"size="15"/>   
                <br><br>                        
                <br><br>            
                <input type="button" value="返回上一页" onclick="javascript:history.back(-1)" /> 
                <br><br>
                    <input type="submit" value="修改"/>
                    <input type="reset" value="重置"/>     
    </p>
    
    </form>  
</body>
</html>
<%@page import="aD.Ac"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>处理</title>
</head>
<body>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<% 
  String calss="学生";

  String num=session.getAttribute("num").toString();
  String pass=session.getAttribute("pass").toString();
  String jiu=(String)request.getParameter("jiu");
  String xin=(String)request.getParameter("xin");
  if(util.queryEmpty(jiu, xin)){
      out.print("<script language ='javaScript'> alert('输入不能为空');window.history.back(-1); </script>");
  }else if(!pass.equals(jiu)){
      out.print("<script language ='javaScript'> alert('旧密码错误');window.history.back(-1); </script>");
  }else if(util.numCha(xin)){
      out.print("<script language ='javaScript'> alert('新密码必须为8位,且必须是数字');window.history.back(-1); </script>");
  }else{
      util.XiuM(xin, num, calss);
      out.print("<script language='javaScript'> alert('修改成功');</script>");   
      response.setHeader("refresh", "0;url=student.jsp");
  }
%>
</body>
</html>
<%@ page contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>教师系统</title>
</head>
      <p style="text-align:center;color:black;font-family:宋体,serif; font-size:20px">
                                        <a>教师系统</a>   
            <br> 
            <br><br>
            <input type="button" value="添加课程" onclick="location.href='teacher-addclass.jsp'" />
            <br><br>
            <input type="button" value="修改个人信息" onclick="location.href='teacher-revise.jsp'" />
            <br><br>
            <input type="button" value="浏览选课学生信息" onclick="location.href='teacher-watch.jsp'" />  
            <br><br>
            <input type="button" value="修改密码" onclick="location.href='Txiu.jsp'" /> 
             <br><br>
            <input type="button" value="登出" onclick="location.href='main.jsp'" />   
    </p>

</html>

<%@ page contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>添加课程</title>
</head>
<body>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<%
String num=session.getAttribute("num").toString();
String classnum=(String)request.getParameter("classnum");
String classname=(String)request.getParameter("classname");
String classmax=(String)request.getParameter("classmax");
String classteacher=session.getAttribute("name").toString();
String classnow="0";

if(util.queryTeacherAdd(classnum, classname,classmax)){
    out.print("<script language ='javaScript'> alert('输入不能为空');window.history.back(-1); </script>");
}else if(util.classnumCha(classnum)){
    out.print("<script language ='javaScript'> alert('课程编号应为6位数字');window.history.back(-1); </script>");
}else if(util.classnumchong(classnum)){
    out.print("<script language ='javaScript'> alert('课程编号已存在');window.history.back(-1); </script>");
}else if(util.pin(classmax)){
    out.print("<script language ='javaScript'> alert('人数上限应为正整数');window.history.back(-1); </script>");
}else if(util.classxichong(classname, classteacher)){
    out.print("<script language ='javaScript'> alert('课程重复,与您已有课程重复');window.history.back(-1); </script>");
}else{
    util.inputClassT(classnum, classname, classmax, classteacher, classnow,num);
    out.print("<script language='javaScript'> alert('添加成功');</script>");
    response.setHeader("refresh", "0;url=teacher.jsp");   
}
%>
</body>
</html>

<%@ page language="java" import="java.sql.*" pageEncoding="utf-8"%>
<html>
<head>
<title>教师信息</title>
</head>
<body>
<table border="1"style="text-align:center">
<caption>教师信息</caption>
<tr>
<td align="center" width=2%>教师工号</td>
<td align="center" width=3%>教师姓名</td>
<td align="center" width=2%>教师性别</td>
<td align="center" width=3%>教师院系</td>
<td align="center" width=2%>教师职位</td>
</tr>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<%
String a=request.getParameter("id");
try{
    Connection connect = util.sjk();
    Statement stmt = connect.createStatement();
    ResultSet rs = stmt.executeQuery("select * from teacher");
    while(rs.next()){    
       if(a.equals(rs.getObject(2).toString()))
       {
           %>
              <tr>
              <td width=2% align="center"><%=rs.getObject(2) %></td>                
              <td width=3% align="center"><%=rs.getObject(3) %></td>        
              <td width=2% align="center"><%=rs.getObject(4) %></td>
              <td width=3% align="center"><%=rs.getObject(5) %></td>
              <td width=2% align="center"><%=rs.getObject(6) %></td>
              </tr>
                <%
       }
   }
   rs.close();
   connect.close();
   stmt.close();
}catch (SQLException e) {
   e.printStackTrace();            
}
%>
</table> 
</body>
   <p style="text-align:center;color:black;font-family:楷体; font-size:20px">    
          <br><br>
                <input type="button" value="返回上一页" onclick="javascript:history.back(-1)" />      
    </p>
</html>
<%@ page language="java" import="java.sql.*" pageEncoding="utf-8"%>
<html>
<head>
<title>修改</title>
</head>
<body>
<table border="1"style="text-align:center">
<caption>教师信息</caption>
<tr>
<td align="center" width=3%>工号</td>
<td align="center" width=3%>姓名</td>
<td align="center" width=2%>性别</td>
<td align="center" width=2%>学院</td>
<td align="center" width=3%>职称</td>
</tr>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<%
String num=session.getAttribute("num").toString();
try{
    Connection connect = util.sjk();
    Statement stmt = connect.createStatement();
    ResultSet rs = stmt.executeQuery("select * from teacher");
    while(rs.next()){    
       if(num.equals(rs.getObject(2).toString()))
       {
           %>
          <tr>
          <td width=3% align="center"><%=rs.getObject(2) %></td>                
          <td width=3% align="center"><%=rs.getObject(3) %></td>        
          <td width=2% align="center"><%=rs.getObject(4) %></td>
          <td width=2% align="center"><%=rs.getObject(5) %></td>
          <td width=3% align="center"><%=rs.getObject(6) %></td>
          </tr>
            <%
       }
   }
   rs.close();
   connect.close();
   stmt.close();
}catch (SQLException e) {
   e.printStackTrace();            
}
%>
</table> 
</body>
<form id="1" action ="teacher-reviseback.jsp" method="get">   
   <p style="text-align:center;color:black;font-family:楷体; font-size:20px">    
                <br>
                姓名:             
                    <input type="text" name="name"size="15"/>
                <br><br>
                性别:             
                    <input type="text" name="sex"size="15"/>
                <br><br>
                学院:             
                    <input type="text" name="yuan"size="15"/>
                <br><br>
                职称:
                <select size ="1"name="zhichen">
                <option value ="教授" selected>教授</option>
                <option value ="副教授">副教授</option>
                <option value ="讲师" >讲师</option>
                <option value ="助教" >助教</option>
                </select>              
                <br><br>                        
                <br><br>            
                <input type="button" value="返回上一页" onclick="javascript:history.back(-1)" /> 
                <br><br>
                    <input type="submit" value="修改"/>
                    <input type="reset" value="重置"/>     
    </p>
    </form>  
</html>
<%@ page contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>修改信息</title>
</head>
<body>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<%
String calss=session.getAttribute("calss").toString();
String num=session.getAttribute("num").toString();
String name=(String)request.getParameter("name");
String sex=(String)request.getParameter("sex");
String yuan=(String)request.getParameter("yuan");
String zhichen=(String)request.getParameter("zhichen");
String num1=num;
if(util.queryTeacherxiu(name, sex, yuan, zhichen)){
      out.print("<script language ='javaScript'> alert('输入不能为空');window.history.back(-1); </script>");
}else{
    util.teacherXiugai(calss, num, name, sex, yuan, zhichen, num1);
    out.print("<script language='javaScript'> alert('修改成功');</script>");
    response.setHeader("refresh", "0;url=teacher.jsp");   
}
%>
</body>
</html>

<%@ page language="java" import="java.sql.*" pageEncoding="utf-8"%>
<html>
<head>
<title>修改</title>
</head>
<body>
<table border="1"style="text-align:center">
<caption>学生选课情况</caption>
<tr>
<td align="center" width=3%>课程编号</td>
<td align="center" width=3%>课程名称</td>
<td align="center" width=3%>学生学号</td>
<td align="center" width=2%>学生姓名</td>
<td align="center" width=2%>学生性别</td>
<td align="center" width=3%>班级</td>
<td align="center" width=3%>专业</td>
</tr>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<%
String num=session.getAttribute("num").toString();
try{
    Connection connect = util.sjk();
    Statement stmt = connect.createStatement();
    ResultSet rs = stmt.executeQuery("select * from xuanke");
    while(rs.next()){    
       if(num.equals(rs.getObject(2).toString()))
       {
           %>
          <tr>
          <td width=3% align="center"><%=rs.getObject(1) %></td>                
          <td width=3% align="center"><%=rs.getObject(3) %></td>        
          <td width=3% align="center"><%=rs.getObject(6) %></td>
          <td width=2% align="center"><%=rs.getObject(7) %></td>
          <td width=2% align="center"><%=rs.getObject(8) %></td>
          <td width=3% align="center"><%=rs.getObject(9) %></td>
          <td width=3% align="center"><%=rs.getObject(10) %></td>
          </tr>
            <%
       }
   }
   rs.close();
   connect.close();
   stmt.close();
}catch (SQLException e) {
   e.printStackTrace();            
}
%>
</table> 
    <p style="text-align:center"> 
        <br><br> 
         <input type="button" value="返回上一页" onclick="javascript:history.back(-1)" /> 
    </p>
</body>       
</html>
<%@ page language="java" import="java.sql.*" pageEncoding="utf-8"%>
<html>
<head>
<title>修改</title>
</head>
<body>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<form id="1" action ="Txiuback.jsp" method="get">   
   <p style="text-align:center;color:black;font-family:楷体; font-size:20px">    
                <br>
                输入旧密码:             
                    <input type="text" name="jiu"size="15"/>
                <br><br>
                输入新密码:
                    <input type="text" name="xin"size="15"/>   
                <br><br>                        
                <br><br>            
                <input type="button" value="返回上一页" onclick="javascript:history.back(-1)" /> 
                <br><br>
                    <input type="submit" value="修改"/>
                    <input type="reset" value="重置"/>     
    </p>
    </form>  
</body>
</html>
<%@ page language="java" import="java.sql.*" pageEncoding="utf-8"%>
<html>
<head>
<title>浏览</title>
</head>
<body>
<table border="1"style="text-align:center">
<caption>课程信息</caption>
<tr>
<td align="center" width=3%>课程编号</td>
<td align="center" width=3%>课程名字</td>
<td align="center" width=3%>课程详细信息</td>
<td align="center" width=3%>教师</td>
</tr>
<jsp:useBean id="util" class="aD.Ac" scope="page" />
<%
try{
    Connection connect = util.sjk();
    Statement stmt = connect.createStatement();
    ResultSet rs = stmt.executeQuery("select * from classim");
    while(rs.next()){    
        String a=rs.getObject(3).toString();
        String b=rs.getObject(5).toString();
        if(!a.equals(b))
        {
        %>
             <tr>
             <td width=3% align="center"><%=rs.getObject(1) %></td>
             <td width=3% align="center"><%=rs.getObject(2) %></td>
             <td width=3% align="center"><a style="color:blue" href='xuanke-back.jsp?id=<%=rs.getObject(1) %>'>课程详细信息</a></td>
             <td width=3% align="center"><%=rs.getObject(4) %></td>                    
             </tr>
             <%
        }
   }
   rs.close();
   connect.close();
   stmt.close();
}catch (SQLException e) {
   e.printStackTrace();            
}
%>
</table> 
</body>   
   <p style="text-align:center;color:black;font-family:楷体; font-size:20px">                           
                <br><br>            
                <input type="button" value="返回上一页" onclick="javascript:history.back(-1)" /> 
   
    </p>
</html>

有人教的