zoukankan      html  css  js  c++  java
  • Java分级考试

    石家庄铁道大学选课管理系统

    1、项目需求:

    本项目所开发的学生选课系统完成学校对学生的选课信息的统计与管理,减少数据漏掉的情况,同时也节约人力、物力和财力。告别以往的人工统计。

    2.系统要求与功能设计

    2.1 页面要求

    1)能够在Tomcat服务器中正确部署,并通过浏览器查看;

    2)网站页面整体风格统一;

    3)首页(登录页)要求实现不同用户登录后,进入的功能页不相同。

    4)教师功能页:有添加课程、修改个人信息、浏览选课学生信息三个模块。

    5)学生功能页:有修改个人信息、浏览课程信息、选课三个功能模块。

    5)管理员功能页:有添加教师信息、添加学生信息两个模块。

    2.2功能要求:

    1)添加教师信息:管理员可以添加教师基本信息,教师基本信息包括:教师工号(八位数字组成,例如02000081)、教师姓名、教师性别、教师所在学院、职称(教授、副教授、讲师、助教)组成;

    2)添加学生信息:管理可以添加学生基本信息,学生基本信息包括学号(八位数字组成,例如20180052)、学生姓名、学生性别、所在班级、所属专业组成;

    3)添加课程信息:教师登陆后,可以添加自己任职的课程基本信息,课程基本信息包括:课程编号(六位数字组成,例如050013),课程名称、选课人数、任课教师(任课教师不需录入,那位教师填写课程信息,那位教师就是任课教师);

    4)修改个人信息:教师或学生登陆后可以修改个人信息,但教师工号或学号不能修改,另外教师或学生只能修改自己的信息,无法看到或修改其他学生或教师的基本信息。

    5)浏览课程信息:学生登陆后可以看到所有课程的列表信息,点击课程名称可以查看课程的详细信息,包括已选课人数;点击教师名称可以查看教师的详细信息。

    6)选课:进入选课页面,课程信息列表显示所有选课人数未达到课程设置的选课人数上限,点击课程名称可以看到课程详细信息,点击课程详细信息页面的“选课”按钮,可以实现选课功能。

    7)浏览选课学生信息:教师进入该页面后,可以看到自己设置的课程信息列表,点击课程名称,可以看到,选择该课程的所有学生基本信息列表。

    8)登陆功能:管理员、教师、学生登陆后可以看到不同的功能页面,教师或学生登陆后只能看到自己的相关信息,不同教师、不同学生登陆后无法查看其他人的信息。(要求至少创建两个教师用户、十个学生用户演示选课过程)

    3数据库设计:

    要求实现课程基本信息表、教师基本信息表、学生基本信息表、选课基本信息表。(提示:选课基本信息包括课程编号、教师编号、学号等基本信息)

    4、WEB发布:

    要求可以实现在浏览器直接访问系统。

    本系统只完成了一部分功能,其他功能还需要进一步的学习

    下面是连接数据库的代码

    package ccc;
    
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    
    public class S {
    
        public static Connection getConnection() {
            try {
                // 1 加载驱动
                Class.forName("com.mysql.cj.jdbc.Driver");
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            String user = "root";
            String password = "123456";
            String url = "jdbc:mysql://localhost:3306/student?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false";
            Connection connection = null;
            try {
                // 2 创建链接对象connection
                connection = DriverManager.getConnection(url, user, password);
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return connection;
        }
    
        // 关闭资源的方法
        public static void close(Connection connection) {
            try {
                if (connection != null) {
                    connection.close();
                }
    
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    
        public static void close(PreparedStatement preparedStatement) {
            try {
                if (preparedStatement != null) {
                    preparedStatement.close();
                }
    
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    
        public static void close(ResultSet resultSet) {
            try {
                if (resultSet != null) {
                    resultSet.close();
                }
    
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    
    }

    下面是数据库表

     下面是具体的代码

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Welcome!</title>
    </head>
    <h1>欢迎来到选课系统</h1><br/><br/>
    <body>
    <br/><br/>
       <p align="center">
       <a href = "guan.jsp">我是管理员</a><br/><br/>
       <a href = "std.jsp">我是学生</a><br/><br/>
        <a href = "tea.jsp">我是教师</a><br/><br/>
       </p>
    </body>
    </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <base href="<%=basePath%>"> 
    16     <title>修改界面</title> 
    17   </head>
    18   <body>
    19     <%
    20     request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
    21     String num = request.getParameter("num");
    22     String name = request.getParameter("name");
    23     String sex = request.getParameter("sex");
    24     String zhi = request.getParameter("zhi");
    25     String collage = request.getParameter("collage");
    26     Connection conn = null; //定义静态数据库连接 
    27     Statement stat = null; 
    28     conn = S.getConnection(); 
    29     stat = conn.createStatement(); 
    30     stat.execute("update a set num='" + num + "' ,name='" + name + "' ,sex='" + sex + "' ,zhi='" + zhi+"' where name='" + name + "'"); 
    31     ResultSet rs = stat.executeQuery("select * from a where name='" + name + "'"); //查找data表id字段
    32     %>
    33    <br>
    34    <h3>修改成功!</h3> <%--标题样式3--%>
    35    <br>
    36    <h3>修改前后的信息对比:</h3> <%--标题样式3--%>
    37    <hr noshade>
    38    <br>
    39    <br>
    40    <table width="450" border="100" cellSpacing=1 style="font-size:15pt;border:dashed 1pt"> <%--表格宽度450--%>
    41     <tr>
    42     <td>工号</td>
    43             <td>姓名</td>
    44             <td>性别</td>
    45             <td>学院</td>
    46             <td>职称</td>
    47     </tr>
    48     <% 
    49     while(rs.next())
    50     {
    51         out.print("<tr>");
    52         out.print("<td>" + rs.getString("num") + "</td>"); //输出name内容
    53         out.print("<td>" + rs.getString("name") + "</td>"); //输出gender内容
    54         out.print("<td>" + rs.getString("sex") + "</td>");
    55         out.print("<td>" + rs.getString("collage") + "</td>"); //输出major内容
    56         out.print("<td>" + rs.getString("zhi") + "</td>");
    57          out.print("</tr>");
    58     }
    59     %>
    60     </table>
    61     <br>
    62     <br>
    63     <a href=教师修改.jsp>返回主页面</a><br/>
    64     <% 
    65     if(rs != null)
    66     {
    67         rs.close(); //关闭结果集,但是rs还是有null值。
    68         rs = null; //将rs滞空。
    69     }
    70         if(stat != null)
    71     {
    72         stat.close(); //关闭stat。
    73         stat = null; //滞空stat。
    74     }
    75         if(conn != null)
    76     {
    77         conn.close(); //关闭数据库连接
    78         conn = null;
    79     }
    80     %> 
    81   </body>
    82 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <base href="<%=basePath%>"> 
    16     <title>修改界面</title> 
    17   </head>
    18   <body>
    19     <%
    20     request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
    21     String num = request.getParameter("num");
    22     String name = request.getParameter("name");
    23     String sex = request.getParameter("sex");
    24     String cla = request.getParameter("cla");
    25     String collage = request.getParameter("collage");
    26     Connection conn = null; //定义静态数据库连接 
    27     Statement stat = null; 
    28     conn = S.getConnection(); 
    29     stat = conn.createStatement(); 
    30     stat.execute("update b set num='" + num + "' ,name='" + name + "' ,sex='" + sex + "' ,cla='" + cla+"' where name='" + name + "'"); 
    31     ResultSet rs = stat.executeQuery("select * from b where name='" + name + "'"); //查找data表id字段
    32     %>
    33    <br>
    34    <h3>修改成功!</h3> <%--标题样式3--%>
    35    <br>
    36    <h3>修改前后的信息对比:</h3> <%--标题样式3--%>
    37    <hr noshade>
    38    <br>
    39    <br>
    40    <table width="450" border="100" cellSpacing=1 style="font-size:15pt;border:dashed 1pt"> <%--表格宽度450--%>
    41     <tr>
    42   <td>学号</td>
    43             <td>姓名</td>
    44             <td>性别</td>
    45             <td>班级</td>
    46             <td>学院</td>
    47     </tr>
    48     <% 
    49     while(rs.next())
    50     {
    51         out.print("<tr>");
    52         out.print("<td>" + rs.getString("num") + "</td>"); //输出name内容
    53         out.print("<td>" + rs.getString("name") + "</td>"); //输出gender内容
    54         out.print("<td>" + rs.getString("sex") + "</td>");
    55         out.print("<td>" + rs.getString("cla") + "</td>"); //输出major内容
    56         out.print("<td>" + rs.getString("collage") + "</td>");
    57          out.print("</tr>");
    58     }
    59     %>
    60     </table>
    61     <br>
    62     <br>
    63     <a href=学生修改.jsp>返回</a><br/>
    64     <% 
    65     if(rs != null)
    66     {
    67         rs.close(); //关闭结果集,但是rs还是有null值。
    68         rs = null; //将rs滞空。
    69     }
    70         if(stat != null)
    71     {
    72         stat.close(); //关闭stat。
    73         stat = null; //滞空stat。
    74     }
    75         if(conn != null)
    76     {
    77         conn.close(); //关闭数据库连接
    78         conn = null;
    79     }
    80     %> 
    81   </body>
    82 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <title>志愿者信息</title> <%--页面标题--%>
    16 
    17   </head>
    18   <body>
    19   <% 
    20   String num = request.getParameter("num");
    21     String name = request.getParameter("name");
    22     String shu = request.getParameter("shu");
    23     String ming = request.getParameter("ming");
    24     Connection conn = null; //定义静态数据库连接 
    25     Statement stat = null; 
    26     ResultSet rs = null; //将rs滞空。
    27     conn = S.getConnection(); 
    28     stat = conn.createStatement(); 
    29     rs = stat.executeQuery("select * from c"); //查找data表
    30   %>
    31   <br>
    32   <h2>课程信息</h2> <%--标题样式2--%>
    33   <hr noshade>    
    34   <br> 
    35   <h3>全部信息如下</h3> <%--标题样式3--%>
    36    <table width="562" border="100" cellSpacing=3 style="font-size:15pt;border:dashed 1pt"> <%--表格宽度450--%>
    37     <tr>
    38     <td width="110">课程编号</td>
    39     <td width="110">课程名称</td>
    40     <td width="211">选课人数</td>
    41     <td width="211">任课教师</td>
    42    
    43     </tr>
    44     <% 
    45     while(rs.next())
    46     {
    47     out.print("<tr>");
    48     out.print("<td>" + rs.getString("num") + "</td>");
    49     out.print("<td>" + rs.getString("name") + "</td>"); //输出name内容
    50     out.print("<td>" + rs.getString("shu") + "</td>"); //输出gender内容
    51     out.print("<td>" + rs.getString("ming") + "</td>");
    52    
    53     out.print("</tr>");
    54     %>
    55    
    56     <%
    57     out.print("</tr>");
    58     }
    59     %>
    60     </table>  
    61     <br>
    62        <form action="cha1.jsp" method="post"> <%--post方法跳转到select_for_age.jsp文件--%>
    63     <h3>按课程名称查询:
    64     <input type="text" name="name"  value="" title="课程名称不能为空" ></input>
    65     <input type="submit" value="查询"/>
    66     <br>
    67     </h3>
    68     </form>
    69     <form action="cha2.jsp" method="post"> <%--post方法跳转到select_for_gender.jsp文件--%>
    70   <h3> 按教师姓名查询:
    71     <input type="text" name="ming" value="" title="教师姓名不能为空"></input>
    72     <input type="submit" value="查询"/>
    73     <br>
    74   </h3>
    75 </form>
    76 
    77 <a href=std.jsp>返回主页面</a>
    78 <% 
    79     if(rs != null)
    80     {
    81         rs.close(); //关闭结果集,但是rs还是有null值。
    82         rs = null; //将rs滞空。
    83     }
    84         if(stat != null)
    85     {
    86         stat.close(); //关闭stat。
    87         stat = null; //滞空stat。
    88     }
    89         if(conn != null)
    90     {
    91         conn.close(); //关闭数据库连接
    92         conn = null;
    93     }
    94     %>
    95   </body>
    96 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <title>志愿者信息</title> <%--页面标题--%>
    16 
    17   </head>
    18   <body>
    19   <% 
    20   String num = request.getParameter("num");
    21   String name = request.getParameter("name");
    22   String sex = request.getParameter("sex");
    23   String zhi = request.getParameter("zhi");
    24   String collage = request.getParameter("collage");   
    25   Connection conn = null; //定义静态数据库连接 
    26     Statement stat = null; 
    27     ResultSet rs = null; //将rs滞空。
    28     conn = S.getConnection(); 
    29     stat = conn.createStatement(); 
    30     rs = stat.executeQuery("select * from a"); //查找data表
    31   %>
    32   <br>
    33   <h2>信息</h2> <%--标题样式2--%>
    34   <hr noshade>    
    35   <br> 
    36   <h3>全部信息如下</h3> <%--标题样式3--%>
    37    <table width="562" border="100" cellSpacing=3 style="font-size:15pt;border:dashed 1pt"> <%--表格宽度450--%>
    38     <tr>
    39     <td width="110">工号</td>
    40     <td width="110">姓名</td>
    41     <td width="211">性别</td>
    42     <td width="211">学院</td>
    43     <td width="211">职称</td>
    44     
    45     </tr>
    46     <% 
    47     while(rs.next())
    48     {
    49     out.print("<tr>");
    50     out.print("<td>" + rs.getString("num") + "</td>"); //输出name内容
    51     out.print("<td>" + rs.getString("name") + "</td>"); //输出gender内容
    52     out.print("<td>" + rs.getString("sex") + "</td>");
    53     out.print("<td>" + rs.getString("collage") + "</td>"); //输出major内容
    54     out.print("<td>" + rs.getString("zhi") + "</td>");
    55     out.print("</tr>");
    56     %>
    57    
    58     <td><a href="update1.jsp?name=<%=rs.getString("name") %>">修改</a></td>
    59     <%
    60     out.print("</tr>");
    61     }
    62     %>
    63     </table>  
    64     
    65 <a href=tea.jsp>返回主页面</a>
    66 <% 
    67     if(rs != null)
    68     {
    69         rs.close(); //关闭结果集,但是rs还是有null值。
    70         rs = null; //将rs滞空。
    71     }
    72         if(stat != null)
    73     {
    74         stat.close(); //关闭stat。
    75         stat = null; //滞空stat。
    76     }
    77         if(conn != null)
    78     {
    79         conn.close(); //关闭数据库连接
    80         conn = null;
    81     }
    82     %>
    83   </body>
    84 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <title>志愿者信息</title> <%--页面标题--%>
    16 
    17   </head>
    18   <body>
    19   <% 
    20   String num = request.getParameter("xing");
    21   String name = request.getParameter("name");
    22   
    23     Connection conn = null; //定义静态数据库连接 
    24     Statement stat = null; 
    25     ResultSet rs = null; //将rs滞空。
    26     conn = S.getConnection(); 
    27     stat = conn.createStatement(); 
    28     rs = stat.executeQuery("select * from d"); //查找data表
    29   %>
    30   <br>
    31   <h2>信息</h2> <%--标题样式2--%>
    32   <hr noshade>    
    33   <br> 
    34   <h3>全部信息如下</h3> <%--标题样式3--%>
    35    <table width="562" border="100" cellSpacing=3 style="font-size:15pt;border:dashed 1pt"> <%--表格宽度450--%>
    36     <tr>
    37      
    38     <td width="110">姓名</td>
    39     <td width="211">课程名称</td>
    40     
    41    
    42     </tr>
    43     <% 
    44     while(rs.next())
    45     {
    46     out.print("<tr>");
    47     out.print("<td>" + rs.getString("xing") + "</td>"); //输出name内容
    48     out.print("<td>" + rs.getString("name") + "</td>"); //输出gender内容
    49     
    50    
    51     out.print("</tr>");
    52     %>
    53    
    54     <%
    55     out.print("</tr>");
    56     }
    57     %>
    58     </table>  
    59     
    60 
    61 
    62 <a href=tea.jsp>返回</a>
    63 <% 
    64     if(rs != null)
    65     {
    66         rs.close(); //关闭结果集,但是rs还是有null值。
    67         rs = null; //将rs滞空。
    68     }
    69         if(stat != null)
    70     {
    71         stat.close(); //关闭stat。
    72         stat = null; //滞空stat。
    73     }
    74         if(conn != null)
    75     {
    76         conn.close(); //关闭数据库连接
    77         conn = null;
    78     }
    79     %>
    80   </body>
    81 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <% 
     3 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     4 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     5 %>
     6 <%
     7 String path = request.getContextPath(); //相对Path设置
     8 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
     9 %>
    10 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    11 <html>
    12   <head>
    13     <title>青年志愿者信息管理系统 </title> <%--页面标题--%>
    14     <body>
    15     <script type="text/javascript" language="JavaScript"> //JS
    16     function validate()
    17     {
    18         var num = document.forms[0].num.value; //创建变量name
    19         var name = document.forms[0].name.value; //创建变量teacher
    20         var shu = document.forms[0].shu.value; 
    21         var ming = document.forms[0].ming.value; 
    22     if(num.length!=6){ //判断姓名位数,必填
    23     alert("课程编号为六位!");
    24         return false;
    25    }
    26     //else if(money.length <= 0){ //判断年龄,必填
    27     //    alert("请输入合法价格!");
    28         //return false;
    29   //  }
    30    // else if(id.length <= 0){ //判断学号位数,必填
    31     //    alert("编号号不能为空,请输入编号!");
    32     //    return false;
    33     //}
    34 
    35    // else if(time.length <= 0){ //专业为必填
    36     //    alert("时间不能为空,请输入菜品时间!");
    37     //    return false;
    38    // }
    39    else{
    40         return true;
    41     }
    42         //document.getElementById("form").submit();
    43     }    
    44     </script>
    45   </head>
    46   <body>
    47   <br>
    48   <%--换行--%>
    49   <center><h2>添加信息</h2>
    50         <hr size="1" noshade color="#000001">
    51         <%--横线--%>
    52         <form action="insert3.jsp" method="post" id="form"
    53             onSubmit="return validate()">
    54             <%--跳转到insert.jsp文件,方法为post--%>
    55             <table width="800" border="0" align="center">
    56                 <%--表格的宽为800,居中对齐--%>
    57  
    58       <tr>
    59         <td>课程编号:
    60           <input type="text" name="num"></td>
    61       </tr>
    62       
    63        <tr>
    64         <td>课程名称: <input type="text" name="name"> </td>
    65       </tr>
    66        <tr>
    67         <td>选课人数: <input type="text" name="shu"> </td>
    68       </tr>
    69     
    70       <tr>
    71         <td>任课教师: <input type="text" name="ming"> </td>
    72       </tr>
    73     
    74     
    75       <tr>
    76                     <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    77                     <input name="submit" type="submit" value="添加" />
    78                     </td>
    79                 </tr>
    80     </table>
    81     <p>&nbsp;</p>
    82   </form>
    83   
    84   </center>
    85   </body>
    86 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <title>课程信息</title> <%--页面标题--%>
    16 
    17   </head>
    18   <body>
    19   <% 
    20   String num = request.getParameter("num");
    21     String name = request.getParameter("name");
    22     String shu = request.getParameter("shu");
    23     String ming = request.getParameter("ming");
    24     Connection conn = null; //定义静态数据库连接 
    25     Statement stat = null; 
    26     ResultSet rs = null; //将rs滞空。
    27     conn = S.getConnection(); 
    28     stat = conn.createStatement(); 
    29     rs = stat.executeQuery("select * from c"); //查找data表
    30   %>
    31   <br>
    32   <h2>课程信息</h2> <%--标题样式2--%>
    33   <hr noshade>    
    34   <br> 
    35   <h3>全部信息如下</h3> <%--标题样式3--%>
    36    <table width="562" border="100" cellSpacing=3 style="font-size:15pt;border:dashed 1pt"> <%--表格宽度450--%>
    37     <tr>
    38     <td width="110">课程编号</td>
    39     <td width="110">课程名称</td>
    40     <td width="211">选课人数</td>
    41     <td width="211">任课教师</td>
    42    
    43     </tr>
    44     <% 
    45     while(rs.next())
    46     {
    47     out.print("<tr>");
    48     out.print("<td>" + rs.getString("num") + "</td>");
    49     out.print("<td>" + rs.getString("name") + "</td>"); //输出name内容
    50     out.print("<td>" + rs.getString("shu") + "</td>"); //输出gender内容
    51     out.print("<td>" + rs.getString("ming") + "</td>");
    52    
    53     out.print("</tr>");
    54     %>
    55    
    56     <%
    57     out.print("</tr>");
    58     }
    59     %>
    60     </table>  
    61     <br>
    62        <form action="xuan.jsp" method="post"> <%--post方法跳转到select_for_age.jsp文件--%>
    63     <h3>按课程名称查询:
    64     <input type="text" name="name"  value="" title="课程名称不能为空" ></input>
    65     <input type="submit" value="查询"/>
    66     <br>
    67     </h3>
    68     </form>
    69     
    70 
    71 <a href=index.jsp>返回主页面</a>
    72 <% 
    73     if(rs != null)
    74     {
    75         rs.close(); //关闭结果集,但是rs还是有null值。
    76         rs = null; //将rs滞空。
    77     }
    78         if(stat != null)
    79     {
    80         stat.close(); //关闭stat。
    81         stat = null; //滞空stat。
    82     }
    83         if(conn != null)
    84     {
    85         conn.close(); //关闭数据库连接
    86         conn = null;
    87     }
    88     %>
    89   </body>
    90 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <title>志愿者信息</title> <%--页面标题--%>
    16 
    17   </head>
    18   <body>
    19   <% 
    20   String num = request.getParameter("num");
    21   String name = request.getParameter("name");
    22   String sex = request.getParameter("sex");
    23   String cla = request.getParameter("cla");
    24   String collage = request.getParameter("collage");   
    25   Connection conn = null; //定义静态数据库连接 
    26     Statement stat = null; 
    27     ResultSet rs = null; //将rs滞空。
    28     conn = S.getConnection(); 
    29     stat = conn.createStatement(); 
    30     rs = stat.executeQuery("select * from b"); //查找data表
    31   %>
    32   <br>
    33   <h2>信息</h2> <%--标题样式2--%>
    34   <hr noshade>    
    35   <br> 
    36   <h3>全部信息如下</h3> <%--标题样式3--%>
    37    <table width="562" border="100" cellSpacing=3 style="font-size:15pt;border:dashed 1pt"> <%--表格宽度450--%>
    38     <tr>
    39     <td width="110">学号</td>
    40     <td width="110">姓名</td>
    41     <td width="211">性别</td>
    42     <td width="211">班级</td>
    43     <td width="211">学院</td>
    44     
    45     </tr>
    46     <% 
    47     while(rs.next())
    48     {
    49     out.print("<tr>");
    50     out.print("<td>" + rs.getString("num") + "</td>"); //输出name内容
    51     out.print("<td>" + rs.getString("name") + "</td>"); //输出gender内容
    52     out.print("<td>" + rs.getString("sex") + "</td>");
    53     out.print("<td>" + rs.getString("cla") + "</td>"); //输出major内容
    54     out.print("<td>" + rs.getString("collage") + "</td>");
    55     out.print("</tr>");
    56     %>
    57    
    58     <td><a href="update2.jsp?name=<%=rs.getString("name") %>">修改</a></td>
    59     <%
    60     out.print("</tr>");
    61     }
    62     %>
    63     </table>  
    64     
    65 <a href=std.jsp>返回主页面</a>
    66 <% 
    67     if(rs != null)
    68     {
    69         rs.close(); //关闭结果集,但是rs还是有null值。
    70         rs = null; //将rs滞空。
    71     }
    72         if(stat != null)
    73     {
    74         stat.close(); //关闭stat。
    75         stat = null; //滞空stat。
    76     }
    77         if(conn != null)
    78     {
    79         conn.close(); //关闭数据库连接
    80         conn = null;
    81     }
    82     %>
    83   </body>
    84 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <% 
     3 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     4 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     5 %>
     6 <%
     7 String path = request.getContextPath(); //相对Path设置
     8 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
     9 %>
    10 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    11 <html>
    12   <head>
    13     <title>青年志愿者信息管理系统 </title> <%--页面标题--%>
    14     <body>
    15     <script type="text/javascript" language="JavaScript"> //JS
    16     function validate()
    17     {
    18         var num = document.forms[0].num.value; //创建变量name
    19         var name = document.forms[0].name.value; //创建变量teacher
    20         var sex = document.forms[0].sex.value; 
    21         var collage = document.forms[0].collage.value; //创建变量address
    22         var cla = document.forms[0].cla.value;
    23     if(num.length!=8){ //判断姓名位数,必填
    24     alert("学号为八位!");
    25         return false;
    26    }
    27     //else if(money.length <= 0){ //判断年龄,必填
    28     //    alert("请输入合法价格!");
    29         //return false;
    30   //  }
    31    // else if(id.length <= 0){ //判断学号位数,必填
    32     //    alert("编号号不能为空,请输入编号!");
    33     //    return false;
    34     //}
    35 
    36    // else if(time.length <= 0){ //专业为必填
    37     //    alert("时间不能为空,请输入菜品时间!");
    38     //    return false;
    39    // }
    40    else{
    41         return true;
    42     }
    43         //document.getElementById("form").submit();
    44     }    
    45     </script>
    46   </head>
    47   <body>
    48   <br>
    49   <%--换行--%>
    50   <center><h2>添加信息</h2>
    51         <hr size="1" noshade color="#000001">
    52         <%--横线--%>
    53         <form action="insert2.jsp" method="post" id="form"
    54             onSubmit="return validate()">
    55             <%--跳转到insert.jsp文件,方法为post--%>
    56             <table width="800" border="0" align="center">
    57                 <%--表格的宽为800,居中对齐--%>
    58  
    59       <tr>
    60         <td>学号:
    61           <input type="text" name="num"></td>
    62       </tr>
    63       <tr>
    64         <td>性别:
    65         
    66         <label><input type="radio" name="sex" value="男">男生</label>
    67         <label><input type="radio" name="sex" value="女">女生</label>
    68     
    69       </tr>
    70        <tr>
    71         <td>姓名: <input type="text" name="name"> </td>
    72       </tr>
    73        <tr>
    74         <td>班级: <input type="text" name="cla"> </td>
    75       </tr>
    76     
    77       <tr>
    78         <td>学院: <input type="text" name="collage"> </td>
    79       </tr>
    80     
    81     
    82       <tr>
    83                     <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    84                     <input name="submit" type="submit" value="添加" />
    85                     </td>
    86                 </tr>
    87     </table>
    88     <p>&nbsp;</p>
    89   </form>
    90   
    91   </center>
    92   </body>
    93 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <% 
     3 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     4 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     5 %>
     6 <%
     7 String path = request.getContextPath(); //相对Path设置
     8 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
     9 %>
    10 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    11 <html>
    12   <head>
    13     <title> </title> <%--页面标题--%>
    14     <body>
    15     <script type="text/javascript" language="JavaScript"> //JS
    16     function validate()
    17     {
    18     var num = document.forms[0].num.value; //创建变量name
    19     var name = document.forms[0].name.value; //创建变量teacher
    20     var sex = document.forms[0].sex.value; 
    21     var collage = document.forms[0].collage.value; //创建变量address
    22     var zhi = document.forms[0].zhi.value;
    23     if(num.length !=8){ //判断姓名位数,必填
    24     alert("工号为八位");
    25         return false;
    26    }
    27     //else if(money.length <= 0){ //判断年龄,必填
    28     //    alert("请输入合法价格!");
    29         //return false;
    30   //  }
    31    // else if(id.length <= 0){ //判断学号位数,必填
    32     //    alert("编号号不能为空,请输入编号!");
    33     //    return false;
    34     //}
    35 
    36    // else if(time.length <= 0){ //专业为必填
    37     //    alert("时间不能为空,请输入菜品时间!");
    38     //    return false;
    39    // }
    40    else{
    41         return true;
    42     }
    43         //document.getElementById("form").submit();
    44     }    
    45     </script>
    46   </head>
    47   <body>
    48   <br>
    49   <%--换行--%>
    50   <center><h2>添加信息</h2>
    51         <hr size="1" noshade color="#000001">
    52         <%--横线--%>
    53         <form action="insert1.jsp" method="post" id="form"
    54             onSubmit="return validate()">
    55             <%--跳转到insert.jsp文件,方法为post--%>
    56             <table width="800" border="0" align="center">
    57                 <%--表格的宽为800,居中对齐--%>
    58  
    59       <tr>
    60         <td>工号:
    61           <input type="text" name="num"></td>
    62       </tr>
    63       <tr>
    64         <td>性别:
    65         
    66         <label><input type="radio" name="sex" value="男">男生</label>
    67         <label><input type="radio" name="sex" value="女">女生</label>
    68     
    69       </tr>
    70        <tr>
    71         <td>姓名: <input type="text" name="name"> </td>
    72       </tr>
    73       <tr>
    74         <td>学院: <input type="text" name="collage"> </td>
    75       </tr>
    76      <tr>
    77                     <td>职称: <select name="zhi" οnchange="showUser(this.value)">
    78                         <option value="教授">教授</option>
    79                         <option value="副教授">副教授</option>
    80                         <option value="讲师">讲师</option>
    81                     </select>
    82                     </td>
    83                 </tr>
    84     
    85       <tr>
    86                     <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    87                     <input name="submit" type="submit" value="添加" />
    88                     </td>
    89                 </tr>
    90     </table>
    91     <p>&nbsp;</p>
    92   </form>
    93   
    94   </center>
    95   </body>
    96 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <base href="<%=basePath%>"> <%--设置基础路径,basepath为变量--%>
    16     <title>按姓名条件查询</title> <%--页面标题--%>
    17   </head>
    18   <body>
    19     <% 
    20     String name = request.getParameter("name");
    21     Connection conn = null; //定义静态数据库连接 
    22     Statement stat = null; //滞空stat。
    23     ResultSet rs = null; //将rs滞空。
    24     conn = S.getConnection(); 
    25     stat = conn.createStatement(); 
    26     rs = stat.executeQuery("select * from c where name like '%" + name + "%'");//查找data表name字段
    27     %>
    28     <br>
    29     <h3>符合条件的信息</h3> <%--标题样式3--%>
    30     <hr noshade> 
    31     <br>
    32      <table width="450" border="100" cellSpacing=1 style="font-size:15pt;border:dashed 1pt"> <%--表格宽度450--%>
    33     <tr>
    34     <td width="110">课程编号</td>
    35     <td width="110">课程名称</td>
    36     <td width="211">选课人数</td>
    37     <td width="211">任课教师</td>
    38     
    39     </tr>
    40     <% 
    41     while(rs.next())
    42     {
    43     out.print("<tr>");
    44     out.print("<td>" + rs.getString("num") + "</td>"); //输出name内容
    45     out.print("<td>" + rs.getString("name") + "</td>"); //输出gender内容
    46     out.print("<td>" + rs.getString("shu") + "</td>");
    47     out.print("<td>" + rs.getString("ming") + "</td>"); //输出major内容
    48         %>
    49 
    50     <%
    51     out.print("</tr>");
    52     }
    53   
    54     %>
    55     </table>    
    56     <br>
    57     <a href=查.jsp>返回</a>
    58     <% 
    59     if(rs != null)
    60     {
    61         rs.close(); //关闭结果集,但是rs还是有null值。
    62         rs = null; //将rs滞空。
    63     }
    64         if(stat != null) //判断stat是否滞空。
    65     {
    66         stat.close(); //关闭stat。
    67         stat = null; //滞空stat。
    68     }
    69         if(conn != null)
    70     {
    71         conn.close(); //关闭数据库连接
    72         conn = null;
    73     }
    74     %> 
    75   </body>
    76 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <base href="<%=basePath%>"> <%--设置基础路径,basepath为变量--%>
    16     <title>按姓名条件查询</title> <%--页面标题--%>
    17   </head>
    18   <body>
    19     <% 
    20     String name = request.getParameter("ming");
    21     Connection conn = null; //定义静态数据库连接 
    22     Statement stat = null; //滞空stat。
    23     ResultSet rs = null; //将rs滞空。
    24     conn = S.getConnection(); 
    25     stat = conn.createStatement(); 
    26     rs = stat.executeQuery("select * from a where name like '%" + name + "%'");//查找data表name字段
    27     %>
    28     <br>
    29     <h3>符合条件的信息</h3> <%--标题样式3--%>
    30     <hr noshade> 
    31     <br>
    32      <table width="450" border="100" cellSpacing=1 style="font-size:15pt;border:dashed 1pt"> <%--表格宽度450--%>
    33     <tr>
    34     <td width="110">工号</td>
    35     <td width="110">姓名</td>
    36     <td width="211">性别</td>
    37     <td width="211">学院</td>
    38     <td width="211">职称</td>
    39     
    40     </tr>
    41     <% 
    42     while(rs.next())
    43     {
    44     out.print("<tr>");
    45     out.print("<td>" + rs.getString("num") + "</td>"); //输出name内容
    46     out.print("<td>" + rs.getString("name") + "</td>"); //输出gender内容
    47     out.print("<td>" + rs.getString("sex") + "</td>");
    48     out.print("<td>" + rs.getString("collage") + "</td>"); //输出major内容
    49     out.print("<td>" + rs.getString("zhi") + "</td>");
    50         %>
    51   
    52     <%
    53     out.print("</tr>");
    54     }
    55   
    56     %>
    57     </table>    
    58     <br>
    59     <a href=查.jsp>返回</a>
    60     <% 
    61     if(rs != null)
    62     {
    63         rs.close(); //关闭结果集,但是rs还是有null值。
    64         rs = null; //将rs滞空。
    65     }
    66         if(stat != null) //判断stat是否滞空。
    67     {
    68         stat.close(); //关闭stat。
    69         stat = null; //滞空stat。
    70     }
    71         if(conn != null)
    72     {
    73         conn.close(); //关闭数据库连接
    74         conn = null;
    75     }
    76     %> 
    77   </body>
    78 </html>
     1 <%@ page language="java" contentType="text/html; charset=UTF-8"
     2     pageEncoding="UTF-8"%>
     3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     4 <html>
     5 <head>
     6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     7 <title>Welcome!</title>
     8 </head>
     9 <h1>欢迎来到选课系统</h1><br/><br/>
    10 <body>
    11 <br/><br/>
    12    <p align="center">
    13    <a href = "addstd.jsp">添加学生信息</a><br/><br/>
    14    <a href = "addtea.jsp">添加教师信息</a><br/><br/>
    15    <a href = "主.jsp">返回</a><br/><br/>
    16    </p>
    17 </body>
    18 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <% 
     3 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     4 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     5 %>
     6 <%
     7 String path = request.getContextPath(); //相对Path设置
     8 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
     9 %>
    10 <!DOCTYPE html>
    11 <html>
    12 <head>
    13 <meta charset="ISO-8859-1">
    14 <title>Insert title here</title>
    15 </head>
    16 <body>
    17                                 选课成功!
    18                                 <a href=std.jsp>返回</a>
    19 </body>
    20 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <base href="<%=basePath%>"> <%--设置基础路径,basepath为变量--%>
    16     <title></title> <%--页面标题--%>
    17   </head>
    18    <body>
    19     <% 
    20     request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
    21     String num = request.getParameter("num");
    22     String name = request.getParameter("name");
    23     String sex = request.getParameter("sex");
    24     String collage = request.getParameter("collage");
    25     String zhi = request.getParameter("zhi");
    26     Connection conn = null; //定义静态数据库连接 
    27     Statement stat = null; 
    28     ResultSet rs = null; //将rs滞空。
    29     conn = S.getConnection();
    30     stat = conn.createStatement(); 
    31     //String sql = ; //向对应的数据字段添加数据
    32     stat.executeUpdate("insert into a(num,name,sex,collage,zhi) values('" +num
    33             + "','" + name + "','" + sex + "','" + collage + "','" +zhi +   "')"); 
    34     rs = stat.executeQuery("select * from a"); //查找data表
    35 %> 
    36    <center>
    37   
    38    <%
    39     if(rs.next())
    40     {
    41     out.print("<br><h3>信息添加成功!</h3>");
    42     }
    43      else{
    44     out.print("<br><h3>信息添加失败!</h3>");
    45     }
    46 
    47     %>
    48 
    49    
    50     <br>
    51    <a href=guan.jsp>返回</a><br/><br/>
    52    
    53 
    54      
    55     </center>
    56      <%
    57     if(rs != null)
    58     {
    59         rs.close(); //关闭结果集,但是rs还是有null值。
    60         rs = null; //将rs滞空。
    61     }
    62         if(stat != null)
    63     {
    64         stat.close(); //关闭stat。
    65         stat = null; //滞空stat。
    66     }
    67         if(conn != null)
    68     {
    69         conn.close(); //关闭数据库连接
    70         conn = null;
    71     }
    72     %>     
    73     </body>
    74 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <base href="<%=basePath%>"> <%--设置基础路径,basepath为变量--%>
    16     <title></title> <%--页面标题--%>
    17   </head>
    18    <body>
    19     <% 
    20     request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
    21     String num = request.getParameter("num");
    22     String name = request.getParameter("name");
    23     String sex = request.getParameter("sex");
    24     String cla = request.getParameter("cla");
    25     String collage = request.getParameter("collage");
    26 
    27     Connection conn = null; //定义静态数据库连接 
    28     Statement stat = null; 
    29     ResultSet rs = null; //将rs滞空。
    30     conn = S.getConnection();
    31     stat = conn.createStatement(); 
    32     //String sql = ; //向对应的数据字段添加数据
    33     stat.executeUpdate("insert into b(num,name,sex,cla,collage) values('" +num
    34             + "','" + name + "','" + sex + "','" + cla + "','" +collage +   "')"); 
    35     rs = stat.executeQuery("select * from b"); //查找data表
    36 %> 
    37    <center>
    38    
    39    <%
    40     if(rs.next())
    41     {
    42     out.print("<br><h3>信息添加成功!</h3>");
    43     }
    44      else{
    45     out.print("<br><h3>信息添加失败!</h3>");
    46     }
    47 
    48     %>
    49 
    50    
    51     <br>
    52    <a href=guan.jsp>返回</a><br/><br/>
    53    
    54      
    55     </center>
    56      <%
    57     if(rs != null)
    58     {
    59         rs.close(); //关闭结果集,但是rs还是有null值。
    60         rs = null; //将rs滞空。
    61     }
    62         if(stat != null)
    63     {
    64         stat.close(); //关闭stat。
    65         stat = null; //滞空stat。
    66     }
    67         if(conn != null)
    68     {
    69         conn.close(); //关闭数据库连接
    70         conn = null;
    71     }
    72     %>     
    73     </body>
    74 </html>
     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     3 <%@page import="ccc.S"%>
     4 <% 
     5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     7 %>
     8 <%
     9 String path = request.getContextPath(); //相对Path设置
    10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
    11 %>
    12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
    13 <html>
    14   <head>
    15     <base href="<%=basePath%>"> <%--设置基础路径,basepath为变量--%>
    16     <title></title> <%--页面标题--%>
    17   </head>
    18    <body>
    19     <% 
    20     request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
    21     String num = request.getParameter("num");
    22     String name = request.getParameter("name");
    23     String shu = request.getParameter("shu");
    24     String ming = request.getParameter("ming");
    25     Connection conn = null; //定义静态数据库连接 
    26     Statement stat = null; 
    27     ResultSet rs = null; //将rs滞空。
    28     conn = S.getConnection();
    29     stat = conn.createStatement(); 
    30     //String sql = ; //向对应的数据字段添加数据
    31     stat.executeUpdate("insert into c(num,name,shu,ming) values('" +num
    32             + "','" + name + "','" + shu + "','" +ming +   "')"); 
    33     rs = stat.executeQuery("select * from c"); //查找data表
    34 %> 
    35    <center>
    36    
    37    <%
    38     if(rs.next())
    39     {
    40     out.print("<br><h3>信息添加成功!</h3>");
    41     }
    42      else{
    43     out.print("<br><h3>信息添加失败!</h3>");
    44     }
    45 
    46     %>
    47 
    48    
    49     <br>
    50    <a href=tea.jsp>返回</a><br/><br/>
    51     
    52      
    53     </center>
    54      <%
    55     if(rs != null)
    56     {
    57         rs.close(); //关闭结果集,但是rs还是有null值。
    58         rs = null; //将rs滞空。
    59     }
    60         if(stat != null)
    61     {
    62         stat.close(); //关闭stat。
    63         stat = null; //滞空stat。
    64     }
    65         if(conn != null)
    66     {
    67         conn.close(); //关闭数据库连接
    68         conn = null;
    69     }
    70     %>     
    71     </body>
    72 </html>
     1 <%@ page language="java" contentType="text/html; charset=UTF-8"
     2     pageEncoding="UTF-8"%>
     3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     4 <html>
     5 <head>
     6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     7 <title>Welcome!</title>
     8 </head>
     9 <h1>欢迎来到选课系统</h1><br/><br/>
    10 <body>
    11 <br/><br/>
    12    <p align="center">
    13    <a href = "学生修改.jsp">修改个人信息</a><br/><br/>
    14    <a href = "查.jsp">浏览课程信息</a><br/><br/>
    15    <a href = "选课.jsp">选课</a><br/><br/>
    16     <a href = "主.jsp">返回</a><br/><br/>
    17    </p>
    18 </body>
    19 </html>
     1 <%@ page language="java" contentType="text/html; charset=UTF-8"
     2     pageEncoding="UTF-8"%>
     3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     4 <html>
     5 <head>
     6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     7 <title>Welcome!</title>
     8 </head>
     9 <h1>欢迎来到选课系统</h1><br/><br/>
    10 <body>
    11 <br/><br/>
    12    <p align="center">
    13    <a href = "教师修改.jsp">修改个人信息</a><br/><br/>
    14    <a href = "添加课程.jsp">添加课程信息</a><br/><br/>
    15    <a href = "浏览.jsp">浏览选课学生</a><br/><br/>
    16    <a href = "主.jsp">返回</a><br/><br/>
    17    </p>
    18 </body>
    19 </html>
      1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
      2 <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
      3 <%@ page import="java.sql.*"%>
      4 <%--导入java中的sql包--%>
      5 <%@page import="ccc.S"%>
      6 <%
      7     request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
      8     response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
      9 %>
     10 <%
     11     String path = request.getContextPath(); //相对Path设置
     12     String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
     13             + path + "/"; //相对Path设置
     14 %>
     15 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     16 <%--文档声明--%>
     17 <html>
     18 <head>
     19 <title>信息</title>
     20 <%--页面标题--%>
     21 <body>
     22     <%--JS--%>
     23     <script type="text/javascript"">
     24         function validate() {
     25             var num = document.forms[0].num.value; //创建变量name
     26             var name = document.forms[0].name.value; //创建变量teacher
     27             var sex = document.forms[0].sex.value; 
     28             var collage = document.forms[0].collage.value; //创建变量address
     29             var zhi = document.forms[0].zhi.value;
     30             if (name.length <= 0) { //判断姓名位数,必填
     31                 alert("姓名不能为空,请输入姓名!");
     32                 return false;
     33             } else if (sex.length <= 0) { //判断学号位数,必填
     34                 alert("姓别不能为空,请输入姓别!");
     35                 return false;
     36             }
     37 
     38             
     39          else {
     40                 return true;
     41             }
     42             //document.getElementById("form").submit();
     43         }
     44     </script>
     45 </head>
     46 <body>
     47     <%
     48         response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     49         request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     50          String num = request.getParameter("num");
     51             String name = request.getParameter("name");
     52             String sex = request.getParameter("sex");
     53             String zhi = request.getParameter("zhi");
     54             String collage = request.getParameter("collage");
     55         Connection conn = null; //定义静态数据库连接 
     56         Statement stat = null; //滞空stat。
     57         ResultSet rs = null; //将rs滞空。
     58         conn = S.getConnection();
     59         stat = conn.createStatement();
     60         rs = stat.executeQuery("select * from a where name='" + name + "'"); //查找data表id字段
     61     %>
     62     <br>
     63     <h2>教师信息</h2>
     64     <hr noshade>
     65     <br>
     66     <h3>要修改的教师信息如下</h3>
     67     <table width="450" border="0" cellpadding="10" cellSpacing=1
     68         style="font-size: 15pt; border: dashed 1pt">
     69         <tr align="center">
     70             <td>工号</td>
     71             <td>姓名</td>
     72             <td>性别</td>
     73             <td>学院</td>
     74             <td>职称</td>
     75             
     76         </tr>
     77         <%
     78             while (rs.next()) {
     79                 out.print("<tr>");
     80                 out.print("<td>" + rs.getString("num") + "</td>"); //输出name内容
     81                 out.print("<td>" + rs.getString("name") + "</td>"); //输出gender内容
     82                 out.print("<td>" + rs.getString("sex") + "</td>");
     83                 out.print("<td>" + rs.getString("collage") + "</td>"); //输出major内容
     84                 out.print("<td>" + rs.getString("zhi") + "</td>");
     85                 out.print("</tr>");
     86         %>
     87     </table>
     88     <br>
     89     <br>
     90     <h3>将信息更改为:</h3>
     91     <form action="1.jsp" method="post"
     92         onSubmit="return validate()">
     93         <h4>
     94             工号:<input type="text" name="num" value="<%=rs.getString("num")%>"
     95                 title="工号不能改变" onClick="return checkName(num)" readonly="readonly"></input><br>
     96         </h4>
     97         <h4>
     98             姓名:<input type="text" name="name" title="不能为空"></input><br>
     99         </h4>
    100         <h4>
    101             性别:<input type="text" name="sex" title="不能为空"></input><br>
    102         </h4>    
    103         <h4>
    104             学院:<input type="text" name="collage" title="不能为空"></input><br>
    105         </h4>
    106             <h4>
    107             职称:<input type="text" name="zhi" title="不能为空"></input><br>
    108         </h4>
    109         <input type="submit" value="修改" />
    110     </form>
    111     <a href=add.jsp>返回添加信息页面</a>
    112     <br />
    113     <a href=show.jsp>返回信息查询页面</a>
    114     <%
    115         }
    116     %>
    117     <%
    118         if (rs != null) {
    119             rs.close(); //关闭结果集,但是rs还是有null值。
    120             rs = null; //将rs滞空。
    121         }
    122         if (stat != null) {
    123             stat.close(); //关闭stat。
    124             stat = null; //滞空stat。
    125         }
    126         if (conn != null) {
    127             conn.close(); //关闭数据库连接
    128             conn = null;
    129         }
    130     %>
    131 </body>
    132 </html>
      1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
      2 <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
      3 <%@ page import="java.sql.*"%>
      4 <%--导入java中的sql包--%>
      5 <%@page import="ccc.S"%>
      6 <%
      7     request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
      8     response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
      9 %>
     10 <%
     11     String path = request.getContextPath(); //相对Path设置
     12     String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
     13             + path + "/"; //相对Path设置
     14 %>
     15 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     16 <%--文档声明--%>
     17 <html>
     18 <head>
     19 <title>信息</title>
     20 <%--页面标题--%>
     21 <body>
     22     <%--JS--%>
     23     <script type="text/javascript"">
     24         function validate() {
     25 
     26             var num = document.forms[0].num.value; //创建变量name
     27             var name = document.forms[0].name.value; //创建变量teacher
     28             var sex = document.forms[0].sex.value; 
     29             var collage = document.forms[0].collage.value; //创建变量address
     30             var cla = document.forms[0].cla.value;
     31             if (name.length <= 0) { //判断姓名位数,必填
     32                 alert("姓名不能为空,请输入姓名!");
     33                 return false;
     34             } else if (sex.length <= 0) { //判断学号位数,必填
     35                 alert("姓别不能为空,请输入姓别!");
     36                 return false;
     37             }
     38 
     39             
     40          else {
     41                 return true;
     42             }
     43             //document.getElementById("form").submit();
     44         }
     45     </script>
     46 </head>
     47 <body>
     48     <%
     49         response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     50         request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     51          String num = request.getParameter("num");
     52             String name = request.getParameter("name");
     53             String sex = request.getParameter("sex");
     54             String cla = request.getParameter("cla");
     55             String collage = request.getParameter("collage");
     56         Connection conn = null; //定义静态数据库连接 
     57         Statement stat = null; //滞空stat。
     58         ResultSet rs = null; //将rs滞空。
     59         conn = S.getConnection();
     60         stat = conn.createStatement();
     61         rs = stat.executeQuery("select * from b where name='" + name + "'"); //查找data表id字段
     62     %>
     63     <br>
     64     <h2>学生信息</h2>
     65     <hr noshade>
     66     <br>
     67     <h3>要修改的学生信息如下</h3>
     68     <table width="450" border="0" cellpadding="10" cellSpacing=1
     69         style="font-size: 15pt; border: dashed 1pt">
     70         <tr align="center">
     71             <td>学号</td>
     72             <td>姓名</td>
     73             <td>性别</td>
     74             <td>班级</td>
     75             <td>学院</td>
     76             
     77         </tr>
     78         <%
     79             while (rs.next()) {
     80                 out.print("<tr>");
     81                 out.print("<td>" + rs.getString("num") + "</td>"); //输出name内容
     82                 out.print("<td>" + rs.getString("name") + "</td>"); //输出gender内容
     83                 out.print("<td>" + rs.getString("sex") + "</td>");
     84                 out.print("<td>" + rs.getString("cla") + "</td>"); //输出major内容
     85                 out.print("<td>" + rs.getString("collage") + "</td>");
     86                 out.print("</tr>");
     87         %>
     88     </table>
     89     <br>
     90     <br>
     91     <h3>将信息更改为:</h3>
     92     <form action="2.jsp" method="post"
     93         onSubmit="return validate()">
     94         <h4>
     95             学号:<input type="text" name="num" value="<%=rs.getString("num")%>"
     96                 title="学号不能改变" onClick="return checkName(num)" readonly="readonly"></input><br>
     97         </h4>
     98         <h4>
     99             姓名:<input type="text" name="name" title="不能为空"></input><br>
    100         </h4>
    101         <h4>
    102             性别:<input type="text" name="sex" title="不能为空"></input><br>
    103         </h4>    
    104         <h4>
    105             班级:<input type="text" name="cla" title="不能为空"></input><br>
    106         </h4>
    107         <h4>
    108             学院:<input type="text" name="collage" title="不能为空"></input><br>
    109         </h4>
    110         <input type="submit" value="修改" />
    111     </form>
    112     <a href=add.jsp>返回添加信息页面</a>
    113     <br />
    114     <a href=show.jsp>返回信息查询页面</a>
    115     <%
    116         }
    117     %>
    118     <%
    119         if (rs != null) {
    120             rs.close(); //关闭结果集,但是rs还是有null值。
    121             rs = null; //将rs滞空。
    122         }
    123         if (stat != null) {
    124             stat.close(); //关闭stat。
    125             stat = null; //滞空stat。
    126         }
    127         if (conn != null) {
    128             conn.close(); //关闭数据库连接
    129             conn = null;
    130         }
    131     %>
    132 </body>
    133 </html>
      1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
      2 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
      3 <%@page import="ccc.S"%>
      4 <% 
      5 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
      6 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
      7 %>
      8 <%
      9 String path = request.getContextPath(); //相对Path设置
     10 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
     11 %>
     12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
     13 <html>
     14   <head>
     15     <base href="<%=basePath%>"> <%--设置基础路径,basepath为变量--%>
     16     <title>按姓名条件查询</title> <%--页面标题--%>
     17   </head>
     18   <body>
     19     <% 
     20     String name = request.getParameter("name");
     21     Connection conn = null; //定义静态数据库连接 
     22     Statement stat = null; //滞空stat。
     23     ResultSet rs = null; //将rs滞空。
     24     conn = S.getConnection(); 
     25     stat = conn.createStatement(); 
     26     rs = stat.executeQuery("select * from c where name like '%" + name + "%'");//查找data表name字段
     27     %>
     28     <br>
     29     <h3>符合条件的信息</h3> <%--标题样式3--%>
     30     <hr noshade> 
     31     <br>
     32      <table width="450" border="100" cellSpacing=1 style="font-size:15pt;border:dashed 1pt"> <%--表格宽度450--%>
     33     <tr>
     34     <td width="110">课程编号</td>
     35     <td width="110">课程名称</td>
     36     <td width="211">选课人数</td>
     37     <td width="211">任课教师</td>
     38     
     39     </tr>
     40     <% 
     41     while(rs.next())
     42     {
     43     out.print("<tr>");
     44     out.print("<td>" + rs.getString("num") + "</td>"); //输出name内容
     45     out.print("<td>" + rs.getString("name") + "</td>"); //输出gender内容
     46     out.print("<td>" + rs.getString("shu") + "</td>");
     47     out.print("<td>" + rs.getString("ming") + "</td>"); //输出major内容
     48         %>
     49 
     50     <%
     51     out.print("</tr>");
     52     }
     53    
     54     %>
     55     </table>    
     56     <br>
     57     <a href=hello.jsp>选课</a>
     58     <% 
     59     if(rs != null)
     60     {
     61         rs.close(); //关闭结果集,但是rs还是有null值。
     62         rs = null; //将rs滞空。
     63     }
     64         if(stat != null) //判断stat是否滞空。
     65     {
     66         stat.close(); //关闭stat。
     67         stat = null; //滞空stat。
     68     }
     69         if(conn != null)
     70     {
     71         conn.close(); //关闭数据库连接
     72         conn = null;
     73     }
     74     %> 
     75      
     76   </body>
     77 </html><%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--设置页面的脚本支持语言为java—导入util包中的类—申明编码方式为UTF-8--%>
     78 <%@ page import="java.sql.*"%> <%--导入java中的sql包--%>
     79 <%@page import="ccc.S"%>
     80 <% 
     81 request.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     82 response.setCharacterEncoding("UTF-8"); //设置响应的编码为UTF-8
     83 %>
     84 <%
     85 String path = request.getContextPath(); //相对Path设置
     86 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; //相对Path设置
     87 %>
     88 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%--文档声明--%>
     89 <html>
     90   <head>
     91     <base href="<%=basePath%>"> <%--设置基础路径,basepath为变量--%>
     92     <title>按姓名条件查询</title> <%--页面标题--%>
     93   </head>
     94   <body>
     95     <% 
     96     String name = request.getParameter("name");
     97     Connection conn = null; //定义静态数据库连接 
     98     Statement stat = null; //滞空stat。
     99     ResultSet rs = null; //将rs滞空。
    100     conn = S.getConnection(); 
    101     stat = conn.createStatement(); 
    102     rs = stat.executeQuery("select * from c where name like '%" + name + "%'");//查找data表name字段
    103     %>
    104     <br>
    105     <h3>符合条件的信息</h3> <%--标题样式3--%>
    106     <hr noshade> 
    107     <br>
    108      <table width="450" border="100" cellSpacing=1 style="font-size:15pt;border:dashed 1pt"> <%--表格宽度450--%>
    109     <tr>
    110     <td width="110">课程编号</td>
    111     <td width="110">课程名称</td>
    112     <td width="211">选课人数</td>
    113     <td width="211">任课教师</td>
    114     
    115     </tr>
    116     <% 
    117     while(rs.next())
    118     {
    119     out.print("<tr>");
    120     out.print("<td>" + rs.getString("num") + "</td>"); //输出name内容
    121     out.print("<td>" + rs.getString("name") + "</td>"); //输出gender内容
    122     out.print("<td>" + rs.getString("shu") + "</td>");
    123     out.print("<td>" + rs.getString("ming") + "</td>"); //输出major内容
    124         %>
    125 
    126     <%
    127     out.print("</tr>");
    128     }
    129    
    130     %>
    131     </table>    
    132     <br>
    133     <a href=hello.jsp>选课</a>
    134     <% 
    135     if(rs != null)
    136     {
    137         rs.close(); //关闭结果集,但是rs还是有null值。
    138         rs = null; //将rs滞空。
    139     }
    140         if(stat != null) //判断stat是否滞空。
    141     {
    142         stat.close(); //关闭stat。
    143         stat = null; //滞空stat。
    144     }
    145         if(conn != null)
    146     {
    147         conn.close(); //关闭数据库连接
    148         conn = null;
    149     }
    150     %> 
    151      
    152   </body>
    153 </html>
  • 相关阅读:
    Maximum Flow Exhaustion of Paths Algorithm
    ubuntu下安装java环境
    visualbox使用(二)
    vxworks一个超级奇怪的错误(parse error before `char')
    February 4th, 2018 Week 6th Sunday
    February 3rd, 2018 Week 5th Saturday
    February 2nd, 2018 Week 5th Friday
    February 1st, 2018 Week 5th Thursday
    January 31st, 2018 Week 05th Wednesday
    January 30th, 2018 Week 05th Tuesday
  • 原文地址:https://www.cnblogs.com/xueqiuxiang/p/12087864.html
Copyright © 2011-2022 走看看