December 23, 2019 afternoon study hall achievements

First, the content

  This afternoon mainly placement test on the week's code has been improved, and increased enrollment, but also encountered problems.

Second, the source code

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<Title> Home </ title>
<style>
    .a{
        font-size: 26px;
        margin-top: 20px;
    }
</style>

</head>
<body>
    <%
         Object message = request.getAttribute("message");
         if(message!=null && !"".equals(message)){
     
    %>
         <script type="text/javascript">
              alert("<%=request.getAttribute("message")%>");
         </script>
    <%} %>
    
    <div align="center">
        <H1 style = "color: blue;"> Hello teacher </ h1>
        <div class="a">
            <a href="index.jsp">注销</a>
        </div>
        <div class="a">
            <a href="teacherUpdate.jsp"> modify personal information </a>
        </div>
        <div class="a">
            <a href="updateServlet?method=classlist"> modify the course information </a>
        </div>
    </div>
</body>
</html>
teacher
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<Title> Amane历 </ title>
<style>
    .a{
        margin-top: 20px;
    }
    .b{
        font-size: 20px;
        width: 160px;
        color: white;
        background-color: greenyellow;
    }
    .tb, td {
        border: 1px solid black;
        font-size: 22px;
    }
</style>
</head>
<body>
    <%
         Object message = request.getAttribute("message");
         Object grade_list = request.getAttribute("grade_list");
         if(message!=null && !"".equals(message)){
     
    %>
         <script type="text/javascript">
              alert("<%=request.getAttribute("message")%>");
         </script>
    <%} %>
    <div align="center">
        <H1 style = "color: red;"> List </ h1>
        <a href="index.jsp"> Back Home </a>
        <table class="tb">
            <tr>
                <Td> Course Number </ td>
                <Td> Course Name </ td>
                <Td> Course capacity </ td>
                <Td> Selected number </ td>
                <td align="center" colspan="2">操作</td>
            </tr>
            <c:forEach items="${class_list}" var="item">
                <tr>
                    <td>${item.cnumber}</td>
                    <td>${item.cname}</td>
                    <td>${item.most}</td>
                    <td>${item.have}</td>
                    <td><a href="classChange.jsp?cnumber=${item.cnumber}&cname=${item.cname}&most=${item.most}&have=${item.have}">修改</a></td>
                    <td><a href="deleteServlet?method=class&id=${item.cnumber}">删除</a></td>
                </tr>
            </c:forEach>
        </table>
    </div>
</body>
</html>
classUpdate
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<Title> increased Course Information </ title>
<style>
    .a{
        margin-top: 20px;
    }
    .b{
        font-size: 20px;
        width: 160px;
        color: white;
        background-color: greenyellow;
    }
    .c{
        margin-top: 20px;
        color: red;
    }
</style>
</head>
<body>
    <div align="center">
        <H1 style = "color: red;"> increase in the class </ h1>
        <a href="teacher.jsp">返回主页</a>
        <form action="updateServlet?method=class" method="post" onsubmit="return check()">
            
            <div class="c">
                课程编号<input type="text" id="cnumber" name="cnumber"  />
            </div>
            <div class="a">
                课程名称<input type="text" id="cname" name="cname" "/>
            </div>
            <div class="a">
                最大容量<input type="text" id="most" name="most" />
            </div>
            <div class="a">
                <button type="submit" class="b">修&nbsp;&nbsp;&nbsp;改</button>
            </div>
        </form>
    </div>
    <script type="text/javascript">
        function check() 
        {
            var sname = document.getElementById("cnumber");
            var ssex= document.getElementById("cname");
            var snumber= document.getElementById("most");
            
            //非空
            if(cnumber.value == '') 
            {
                Alert ( 'course number is empty' );
                cnumber.focus();
                return false;
            }
            
            else if(cname.value == '')
            {
                Alert ( 'Course name is empty' );
                cname.focus();
                return false;
            }
            else if(most.value == '')
            {
                Alert ( 'empty capacity course' );
                most.focus();
                return false;
            }
        }
    </script>
</body>
</html>
classChange

Third, feelings

  Programming code is not enough skilled, especially between servlet and jsp jump when the need to guide relationship guide for a long time, you also need more practice. And also to find time to learn el expression in the class, this value is useful. And by learning, I learned how to build a dynamic table, by rights have different rights to different database traversal search and then displayed on the screen, each one has its own corresponding address, obtain the corresponding dynamic pages by el expression, then hyperlink.

Guess you like

Origin www.cnblogs.com/suanai/p/12088148.html