1 2 3 4

11.20

持续更新

学生主页代码

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="dao.SchoolDaoImpl"  %>
    <%@page import= "java.util.*" %>
    <%@page import="entity.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>

<%
        String stuID=(String)request.getSession().getAttribute("ID");
            //String teacherID=(String)request.getAttribute("ID");
        session.setAttribute("stuID", stuID);
        request.setAttribute("stuID", stuID);
        System.out.println(stuID);
                      
                  %>
                      <%
                      List<School> list=(List<School>)request.getAttribute("list");
                      if(list!=null&&list.size()>=1){
                          for(School school:list){

                  %>
 
                          <%String stuname=school.getStuname(); 
                          session.setAttribute("stuname", stuname);
                        request.setAttribute("stuname",stuname );%>

                          <%String stusex=school.getStusex(); 
                          session.setAttribute("stusex", stusex);
                        request.setAttribute("stusex",stusex);%>
                        
                          <%String stuclass=school.getStuclass(); 
                          session.setAttribute("stuclass", stuclass);
                        request.setAttribute("stuclass",stuclass );%>
                                
                          <%String stumajor=school.getStumajor() ; 
                          session.setAttribute("stumajor", stumajor);
                        request.setAttribute("stumajor",stumajor);
                        System.out.println(stumajor);
                        %>
                  <%}
                          
                          
                }
                  %>

                 

<div id="addSubjectForm" align="center">
                <form action="SubjectAddServlet" method="post">
                <tr>
                <h1>学生系统</h1> 
                <ul>
                <li><a href="Studentservlet?method=showclass">浏览课程信息 </a></li>
                <li><a href="Studentservlet?method=show">修改个人信息 </a></li>
                <li><a href="Studentservlet?method=classshow">选课 </a></li>
                <li><a href="school.jsp">退出登录 </a></li>
                </ul>
                </form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="dao.SchoolDaoImpl"  %>
    <%@page import= "java.util.*" %>
    <%@page import="entity.*" %>
<!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>Insert title here</title>
</head>
<body>
<div id="stushow" align="center"><!--显示试题-->

            
                      <%
                      List<School> list=(List<School>)request.getAttribute("list");
                      
                      
                      if(list==null||list.size()<1){
                          response.setHeader("refresh",

                                "5;URL=Teacherservlet?method=showclass");
                      %>
                      <font color="red" size="5"> 查询信息时出现错误,未能读出您的信息<br> 五秒后将跳转到主页面 <br>

                如果没有跳转,请点击 <a href="Teacherservlet?method=showclass">这里</a>!!! <br>

            </font>
                      <% }
                      else{
                          
                      %>
                          <table border="0" cellspacing="10" cellpadding="0">
                        <tr>
                        <td align="center" colspan="5">
                        
                        <h1>当前选此课程的学生信息</h1>
                        </td>
                        </tr>
                        <tr align="center">
                                <td><b>学号</b></td>
                                <td><b>姓名</b></td>
                                <td><b>性别</b></td>
                                <td><b>班级</b></td>
                                <td><b>专业</b></td>
                            </tr>
                       <%
                          for(School school:list){
                          
                  %>
                  <tr align="center">
                          <td><%=school.getStuID() %></td>
                          <td><%=school.getStuname()%></td>
                          <td><%=school.getStusex()%></td>
                          <td><%=school.getStuclass() %></td>
                          <td><%=school.getStumajor() %></td>
                  </tr>
                  
                  
                  <%}
                       } %>
                      <font color="red" size="5"> 查看完毕后<br>  <br>

                请点击 <a href="Teacherservlet?method=showclass">这里</a>回到课程信息页面!!! <br>

            </font>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="dao.SchoolDaoImpl"  %>
    <%@page import= "java.util.*" %>
    <%@page import="entity.*" %>
<!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>Insert title here</title>
</head>
<body>
<div id="stushowclass" align="center"><!--显示试题-->

            
                      <%
                      List<School> list=(List<School>)request.getAttribute("list");
                      
                      
                      if(list==null||list.size()<1){
                          response.setHeader("refresh",

                                "5;URL=teacher.jsp");
                      %>
                      <font color="red" size="5"> 查询信息时出现错误,未能读出课程的信息<br> 五秒后将跳转到主页面 <br>

                如果没有跳转,请点击 <a href="teacher.jsp">这里</a>!!! <br>

            </font>
            
                      <% }
                      else{%>
                          <table border="0" cellspacing="10" cellpadding="0">
                        <tr>
                        <td align="center" colspan="5">
                        <h1>当前所有课程信息</h1>
                        </td>
                        </tr>
                        <tr align="center">
                                <td><b>任课教师</b></td>
                                <td><b>课程编号</b></td>
                                <td><b>课程名称</b></td>
                                
                                <td><b>课程最大人数</b></td>
                                <td><b>课程现选人数</b></td>
                            </tr>
                       <%
                          for(School school:list){
                          
                  %>
                          <tr align="center">
                          
                          <td><%=school.getTeachername() %></td>
                          <td><%=school.getClassID() %></td>
                          <td><a href="Teacherservlet?method=showstudent&classID=<%=school.getClassID()%>"><%=school.getClassname()%></td>
                          
                          
                          
                          <td><%=school.getClassnum() %></td>
                          <td><%=school.getClassnow() %></td>
                  </tr>
                  
                  <%}
                      
                  %>
                 <tr align="center">
                  <font color="red" size="5"> <br> 如果不再修改 <br>

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

            </font>
                  </tr>
                 <%} %>
</body>
</html>

javabean数据文件代码

package entity;

public class School {
    private String profession;
    private String uesername;
    private String password;
    
    private String teacherpassword;
    private String teacherID;//工号
    private String teachersex;//性别
    private String teachercollege;//学院
    private String teachername;//姓名
    private String teachercall;//职称
    
    private String stupassword;
    private String stuname; //姓名
    private String stuID;//学号
    private String stusex;//性别
    private String stuclass;//班级
    private String stumajor;//专业
    
    private String classID;
    private String classname;
    private String classnum;
    private int classnow;//当前选课人数
    
    public String getTeacherpassword() {
        return teacherpassword;
    }
    public void setTeacherpassword(String teacherpassword) {
        this.teacherpassword = teacherpassword;
    }
    public String getStupassword() {
        return stupassword;
    }
    public void setStupassword(String stupassword) {
        this.stupassword = stupassword;
    }
    public int getClassnow() {
        return classnow;
    }
    public void setClassnow(int classnow) {
        this.classnow = classnow;
    }
    public String getClassID() {
        return classID;
    }
    public void setClassID(String classID) {
        this.classID = classID;
    }
    public String getClassname() {
        return classname;
    }
    public void setClassname(String classname) {
        this.classname = classname;
    }
    public String getClassnum() {
        return classnum;
    }
    public void setClassnum(String classnum) {
        this.classnum = classnum;
    }
    public String getProfession() {
        return profession;
    }
    public void setProfession(String profession) {
        this.profession = profession;
    }
    public String getUesername() {
        return uesername;
    }
    public void setUesername(String uesername) {
        this.uesername = uesername;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getTeacherID() {
        return teacherID;
    }
    public void setTeacherID(String teacherID) {
        this.teacherID = teacherID;
    }
    public String getTeachersex() {
        return teachersex;
    }
    public void setTeachersex(String teachersex) {
        this.teachersex = teachersex;
    }
    public String getTeachercollege() {
        return teachercollege;
    }
    public void setTeachercollege(String teachercollege) {
        this.teachercollege = teachercollege;
    }
    public String getTeachername() {
        return teachername;
    }
    public void setTeachername(String teachername) {
        this.teachername = teachername;
    }
    public String getTeachercall() {
        return teachercall;
    }
    public void setTeachercall(String teachercall) {
        this.teachercall = teachercall;
    }
    public String getStuname() {
        return stuname;
    }
    public void setStuname(String stuname) {
        this.stuname = stuname;
    }
    public String getStuID() {
        return stuID;
    }
    public void setStuID(String stuID) {
        this.stuID = stuID;
    }
    public String getStusex() {
        return stusex;
    }
    public void setStusex(String stusex) {
        this.stusex = stusex;
    }
    public String getStuclass() {
        return stuclass;
    }
    public void setStuclass(String stuclass) {
        this.stuclass = stuclass;
    }
    public String getStumajor() {
        return stumajor;
    }
    public void setStumajor(String stumajor) {
        this.stumajor = stumajor;
    }


    
   
}

 

posted @ 2020-11-20 22:51  小陈的太阳  阅读(87)  评论(0编辑  收藏  举报