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

添加信息

add

<%--
  Created by IntelliJ IDEA.
  User: 榕宝
  Date: 2021/11/26
  Time: 14:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加学生信息</title>
    <style type="text/css">
        .bg {

            background-size:cover;
        }
    </style>
</head>
<body class="bg">
<div>
    <form action="servlet?method=add" method="post" id="form" onsubmit="return check()" >
        <table>

            <tr>
                <td>姓名</td>
                <td><input type="text" name="sname" ></td>
            </tr>
            <tr>
                <td>性别</td>
                <td><input type="radio" name="ssex" value="男">男&nbsp;
                    <input type="radio" name="ssex" value="女">女</td>
            </tr>
            <tr>
                <td>学号</td>
                <td><input type="text" name="sid" ></td>
            </tr>
            <tr>
                <td>班级</td>
                <td><input type="text" name="classid" ></td>
            </tr>
            <tr>
            <tr>
                <td>专业</td>
                <td><input type="text" name="zhuanye" ></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="submit" value="确认" ></td>
            </tr>
            <tr align="center">
                 <br> 如果不再修改 <br>

                    请点击 <a href="manager.jsp">这里回到主页面</a>!!! <br>


            </tr>
        </table>
    </form>
</div>
</body>
<script type="text/javascript">
    function check(){
        obj=document.getElementById('form');
        if(obj.sname.value===""||obj.ssex.value===""||obj.classid.value===""||obj.zhuanye.value===""||obj.sid.value===""){
            alert("请将信息填写完整");
            return false;
        }
    }
</script>
</html>

add2

<%--
  Created by IntelliJ IDEA.
  User: 榕宝
  Date: 2021/11/26
  Time: 16:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加教师信息</title>
    <style type="text/css">
        .bg {

            background-size:cover;
        }
    </style>
</head>
<body class="bg">
<div>
    <form action="servlet?method=add" method="post" id="form" onsubmit="return check()" >
        <table>

            <tr>
                <td>姓名</td>
                <td><input type="text" name="tname" ></td>
            </tr>
            <tr>
                <td>性别</td>
                <td><input type="radio" name="tsex" value="男">男&nbsp;
                    <input type="radio" name="tsex" value="女">女</td>
            </tr>
            <tr>
                <td>工号</td>
                <td><input type="text" name="tid" ></td>
            </tr>
            <tr>
                <td>学院</td>
                <td><input type="text" name="xueyuan" ></td>
            </tr>
            <tr>
            <tr>
            <td>职称</td>
            <td>
                <label>
                    <select name="zhicheng">
                        <option value="教授">教授</option>
                        <option value="副教授">副教授</option>
                        <option value="讲师">讲师</option>
                        <option value="助教" selected>助教</option>
                    </select>
                </label>
            </td>
        </tr>
            <tr>
                <td></td>
                <td><input type="submit" value="确认" ></td>
            </tr>
            <tr align="center">
                <br> 如果不再修改 <br>

                    请点击 <a href="manager.jsp">这里回到主页面</a>!!! <br>


            </tr>
        </table>
    </form>
</div>
</body>
<script type="text/javascript">
    function check(){
        obj=document.getElementById('form');
        if(obj.sname.value===""||obj.ssex.value===""||obj.classid.value===""||obj.zhuanye.value===""||obj.sid.value===""){
            alert("请将信息填写完整");
            return false;
        }
    }
</script>
</html>

add3

<%--
  Created by IntelliJ IDEA.
  User: 榕宝
  Date: 2021/11/27
  Time: 15:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加课程信息</title>
    <style type="text/css">
        .bg {

            background-size:cover;
        }
    </style>
</head>
<body class="bg">
<div>
    <form action="servlet?method=add" method="post" id="form" onsubmit="return check()" >
        <table>


            <tr>
                <td>课程编号:</td>
                <td>
                    <input pattern="[a-zA-Z0-9]{6,6}" name="bianhao" >
                </td>
            </tr>
            <tr>
                <td>课程名称:</td>
                <td>
                    <input type="text" name="cname">
                </td>
            </tr>

            <tr>
                <td>选课人数:</td>
                <td>
                    <input type="text" name="num">
                </td>
            </tr>



            <tr>
                <td colspan="2"><div align="center">
                    <input type="submit" value="添加课程">
                </div>
                </td>
            </tr>
            <tr align="center">
                 <br> 如果不再修改 <br>

                    请点击 <a href="teacher.jsp">这里回到主页面</a>!!! <br>

            </tr>
        </table>

    </form>
</div>
</body>
<script type="text/javascript">
    function check(){
        obj=document.getElementById('form');
        if(obj.cname.value===""||obj.num.value===""||obj.bianhao.value===""){
            alert("请将信息填写完整");
            return false;
        }
    }
</script>
</html>

addlesson

<%--
  Created by IntelliJ IDEA.
  User: 榕宝
  Date: 2021/11/27
  Time: 15:33
  To change this template use File | Settings | File Templates.
--%>
<%@page import="Dao.dao"%>
<%@page import="Bean.lesson"%>
<%@ page import="Bean.teacher" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加课程信息</title>
</head>
<body>
<%
    request.setCharacterEncoding("utf-8");
    response.setCharacterEncoding("utf-8");
    lesson lesson=new lesson();
   lesson.setBianhao(request.getParameter("bianhao"));
    lesson.setNum(request.getParameter("num"));
    lesson.setName(request.getParameter("cname"));
    lesson.setTeacher((String) request.getAttribute("teacher"));
    dao.addLesson(lesson);
    response.sendRedirect("index.jsp");
%>
</body>
</html>

addstudent

<%--
  Created by IntelliJ IDEA.
  User: 榕宝
  Date: 2021/11/26
  Time: 15:08
  To change this template use File | Settings | File Templates.
--%>
<%@page import="Dao.dao"%>
<%@page import="Bean.student"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加学生信息</title>
</head>
<body>
<%
    request.setCharacterEncoding("utf-8");
    response.setCharacterEncoding("utf-8");
    student student=new student();

    student.setSid(request.getParameter("sid"));
    student.setName(request.getParameter("sname"));
    student.setSex(request.getParameter("ssex"));
    student.setClassid(request.getParameter("classid"));
    student.setZhuanye(request.getParameter("zhuanye"));
    dao.addStudent(student);
    response.sendRedirect("index.jsp");
%>
</body>
</html>

addteacher

<%--
  Created by IntelliJ IDEA.
  User: 榕宝
  Date: 2021/11/26
  Time: 16:06
  To change this template use File | Settings | File Templates.
--%>
<%@page import="Dao.dao"%>
<%@page import="Bean.student"%>
<%@ page import="Bean.teacher" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加教师信息</title>
</head>
<body>
<%
    request.setCharacterEncoding("utf-8");
    response.setCharacterEncoding("utf-8");
    teacher teacher=new teacher();

    teacher.setTid(request.getParameter("tid"));
    teacher.setName(request.getParameter("tname"));
    teacher.setSex(request.getParameter("tsex"));
    teacher.setXueyuan(request.getParameter("xueyuan"));
    teacher.setZhicheng(request.getParameter("zhicheng"));
    dao.addTeacher(teacher);
    response.sendRedirect("index.jsp");
%>
</body>
</html>

修改教师信息

<%--
  Created by IntelliJ IDEA.
  User: 榕宝
  Date: 2021/11/26
  Time: 16:31
  To change this template use File | Settings | File Templates.
--%>
<%@page import="Dao.dao"%>
<%@page import="Bean.student"%>
<%@ page import="Bean.teacher" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>修改学生信息</title>
    <style type="text/css">
        .bg {

            background-size:cover;
        }
    </style>
</head>
<body class="bg">
<%
    request.setCharacterEncoding("utf-8");
    response.setCharacterEncoding("utf-8");
    int tid = Integer.parseInt(request.getParameter("id"));
    teacher teacher=dao.getTeacher(tid);
%>
<form action="updateteacher.jsp" method="post" id="form" onsubmit="return check()" >
    <input type="hidden" name="id" value="<%=tid%>">
    <table>
        <tr>
            <td>姓名</td>
            <td><input type="text" name="tname" ></td>
        </tr>
        <tr>
            <td>性别</td>
            <td><input type="radio" name="tsex" value="男">男&nbsp;
                <input type="radio" name="tsex" value="女">女</td>
        </tr>
        <tr>
            <td>工号</td>
            <td><input type="text" name="tid" ></td>
        </tr>
        <tr>
            <td>学院</td>
            <td><input type="text" name="xueyuan" ></td>
        </tr>
        <tr>
        <tr>
            <td>职称</td>
            <td>
                <label>
                    <select name="zhicheng">
                        <option value="教授">教授</option>
                        <option value="副教授">副教授</option>
                        <option value="讲师">讲师</option>
                        <option value="助教" selected>助教</option>
                    </select>
                </label>
            </td>
        </tr>
            <td><input type="submit" value="确认" ></td>

    </table>
</form>
<script type="text/javascript">
    window.onload=function(){
        var obj=document.getElementById("form");
        obj.tname.value="<%=teacher.getName()%>";
        obj.tsex.value="<%=teacher.getSex()%>";
        obj.xueyuan.value="<%=teacher.getXueyuan()%>";
        obj.zhicheng.value="<%=teacher.getZhicheng()%>";
    }
</script>
<script type="text/javascript">
    function check(){
        obj=document.getElementById('form');
        if(obj.tname.value===""||obj.tsex.value===""||obj.xueyuan.value===""||obj.zhicheng.value===""){
            alert("请将信息填写完整");
            return false;
        }
    }
</script>
</body>
</html>

 

posted @ 2021-11-27 23:00  zrswheart  阅读(69)  评论(0编辑  收藏  举报