• 登录注册


    主程序为

    <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>首页</title>

    </head>
    <body>
    <div align="center">

    <div class="a">
    <a href="add.jsp">课程信息添加</a>
    </div>
    <div class="a">
    <a href="CourseServlet?method=list">课程信息修改</a>
    </div>
    <div class="a">
    <a href="del.jsp">课程信息删除</a>
    </div>
    <div class="a">
    <a href="search.jsp">课程信息查询</a>
    </div>
    </div>
    </body>
    </html>

    2.添加程序

    <%@ 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>

    </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: black;">课程信息录入</h1>
    <a href="index.jsp">返回主页</a>
    <form action="CourseServlet?method=add" method="post" onsubmit="return check()">
    <div class="a">
    课程名称<input type="text" id="name" name="name"/>
    </div>
    <div class="a">
    任课教师<input type="text" id="teacher" name="teacher" />
    </div>
    <div class="a">
    上课地点<input type="text" id="classroom" name="classroom" />
    </div>
    <div class="a">
    <button type="submit" class="b">保&nbsp;&nbsp;&nbsp;存</button>
    </div>
    </form>
    </div>
    <script type="text/javascript">
    function check() {
    var name = document.getElementById("name");
    var teacher = document.getElementById("teacher");
    var classroom = document.getElementById("classroom");

    //非空
    if(name.value == '') {
    alert('课程名称为空');
    name.focus();
    return false;
    }
    if(teacher.value == '') {
    alert('教师为空');
    teacher.focus();
    return false;
    }
    if(classroom.value == '') {
    alert('上课地点为空');
    classroom.focus();
    return false;
    }

    //教师
    if(teacher.value != '王建民' && teacher.value != '王辉' && teacher.value != '刘丹' && teacher.value != '刘立嘉' && teacher.value != '杨子光'){
    alert('教师名称错误');
    return false;
    }

    //教室
    if(!/^基教/.test(classroom.value) && !/^一教/.test(classroom.value) && !/^二教/.test(classroom.value) && !/^三教/.test(classroom.value)) {
    alert('上课地点错误');
    return false;
    }
    }
    </script>
    </body>
    </html>

  • 相关阅读:
    RUP十大要素的应用
    使用ASP.NET 3.5 Extensions管理浏览器历史:使用服务器端
    Autodesk云计算系列视频 开篇介绍 Up to the cloud 直上云端
    AIMS 2012 不能登录的问题
    Autodesk Infrastructure Modeler (原Galileo伽利略项目)已经正式发布
    MapGuide开发中使用Fusion Viewer及通过程序开关图层
    MapGuide OpenSource 2.2 安装中的数字签名错误
    MapGuide / Map 3D 开发常用资料链接
    基于MapGuide的在线WebGIS站点再介绍
    Autodesk云计算系列视频 云计算与Civil 3D
  • 原文地址:https://www.cnblogs.com/PSLQYZ/p/11717156.html
Copyright © 2020-2023  润新知