2020/12/08

选课的一些jsp层

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
    .a{
        margin-top: 20px;
    }
    .b{
        font-size: 20px;
         160px;
        color: white;
        background-color: greenyellow;
    }
</style>
</head>
<body>
<center>
<h2 style="color: red;">管理员登录界面</h2>
<div>
<a href="tadd.jsp">1.教师信息录入</a>
</div>
<div>
<div>
</div>
<a href="sadd.jsp">2.学生信息录入界面</a>
</div>
</center>
    
</body>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
    .a{
        margin-top: 20px;
    }
    .b{
        font-size: 20px;
         160px;
        color: white;
        background-color: greenyellow;
    }
</style>
</head>
<body>
<center>
<h2 style="color: red;">登记</h2>
<div>
<a href="tdenglu.jsp">1.老师登录界面</a>
</div>
<div>
<div>
</div>
<a href="student.jsp">2.学生登录界面</a>
</div>
<div>
</div>
<div>
<a href="boss.jsp">3.管理员登录界面</a>
</div>
    </center>
</body>
<%@ 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>Insert title here</title>
<style>
    .a{
        margin-top: 20px;
	}
    .b{
        font-size: 20px;
         160px;
        color: white;
        background-color: greenyellow;
    }
</style>
</head>
<body>
    <%
         Object message = request.getAttribute("message");
         if(message!=null && !"".equals(message)){
      
    %>
         <script type="text/javascript">
              alert("<%=request.getAttribute("message")%>");
         </script>
    <%} %>
    
    <%
	String tname=(String) session.getAttribute("tname");
	%>

    <div align="center">
        <h1 style="color: red;">课程信息登记</h1>
         <form action="Servlet?method=classadd" method="post" >
     
            <div class="a">
                课程编号:<input type="text" id="kid" name="kid" />
            </div>
            <div class="a">
               课程名称:<input type="text" id="kname" name="kname" />
                 </div>
                 
            <div class="a">
               选课人数:<input type="text" id="knumber" name="knumber" />
                 </div>     
                 
          <div class="a">
               任课教师:<input type="text" id="kteacher" name="kteacher" value=<%=tname %>>(修改无效)
                 </div>   
        
                     
            <div class="a">
                <button type="submit" class="b">提  交<tton>
            </div>
            
        </form>
    </div>
</body>

	
    
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
    .a{
        margin-top: 20px;
    }
    .b{
        font-size: 20px;
         160px;
        color: white;
        background-color: greenyellow;
    }
</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: red;">学生信息登记</h1>
        <form action="Servlet?method=sadd" method="post" >
     
            <div class="a">
                学生学号:<input type="text" id="sid" name="sid" />
            </div>
            <div class="a">
               学生姓名:<input type="text" id="sname" name="sname" />
                 </div>
                 
            <div class="a">
               学生性别:<input type="text" id="ssex" name="ssex" />
                 </div>     
                 
          <div class="a">
               学生所在班级:<input type="text" id="sclass" name="sclass" />
                 </div>   
                      
              <div class="a">
               学生所在专业:<input type="text" id="szy" name="szy" />
                 </div>  
 				
 				</select>
                 </div>      
                 <center>
            <div class="a">
                <button type="submit" class="b">提  交<tton>
            </div>
            </center>  
        </form>
    </div>
	
    <script type="text/javascript">
   
    
        function check() {
        	 var sid = document.getElementById("sid");
            var sname = document.getElementById("sname");
            var ssex = document.getElementById("ssex");
        	var sclass= document.getElementById("sclass");
            var szy = document.getElementById("szy");
             
            //非空
            if(sid.value == '') {
                alert('学号有误');
                sid.focus();
                return false;
            }
            else if(sname.value == '') {
                alert('名字有误');
                sname.focus();
                return false;
            }
            else if(ssex.value == '') {
                alert('性别有误');
                ssex.focus();
                return false;
            }
            else if(sclass.value == '') {
                alert('班级为空');
                sclass.focus();
                return false;
            }
            else if(szy.value == '') {
                alert('专业为空');
                szy.focus();
                return false;
            }
                   
              else
            {
            	alert('添加成功');
            	}
        }
            </script type="text/javascript">
原文地址:https://www.cnblogs.com/qiangini/p/14162171.html