Java+Servlet+JSP实现Web宠物诊所管理系统

一、系统介绍

软件环境
IDEA:2018.2
Java:jdk1.8
Mysql:8.0.13
Tomcat:8.5.23

系统功能
1.用户的注册与登录
2.宠物信息的增删改查
3.医生信息的增删改查。

数据库涉及的表
userinfo
petdoctor
petdetalis

二、系统展示

1.登录

在这里插入图片描述

2.注册

在这里插入图片描述

3.宠物查询主页面

在这里插入图片描述

4.宠物查询结果

在这里插入图片描述

5.宠物信息修改

在这里插入图片描述

6.宠物信息新增

在这里插入图片描述

7.医生查询主界面

在这里插入图片描述

8.医生查询结果

在这里插入图片描述

9.医生信息修改

在这里插入图片描述

10.医生信息新增

在这里插入图片描述

三、代码实现

1.前端

init.jsp

<%@ page language="java" pageEncoding="UTF-8" %>

<%
    session.setAttribute("error", "test");
%>
<jsp:forward page="login.jsp"></jsp:forward>

login.jsp

<%@ page language="java" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>请登录</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/css.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        #content {
            position: relative;
            top: 3px;
            width: 80%;
            height: 380px;
            margin: auto;
            overflow: hidden;
            z-index: 2;
        }

        .tab1 {
            position: relative;
            top: 100px;
            font-size: 24px;
        }

        #in1 {
            width: 250px;
            height: 30px;
            font-size: 24px;
        }

        #in3 {
            width: 250px;
            height: 30px;
            font-size: 24px;
        }

        #in2 {
            width: 80px;
            height: 28px;
        }
    </style>
    <script type="text/javascript">
        function checkId() {
            if (document.getElementById("in1").value == ""
                && document.getElementById("in3").value == "") {
                alert("请输入用户名和密码!");
                return false;
            } else if (document.getElementById("in1").value == "") {
                alert("请输入用户名");
                return false;
            } else if (document.getElementById("in3").value == "") {
                alert("请输入密码!");
                return false;
            } else {
                return true;
            }
        }
    </script>
</head>
<body>
<%
    if (session.getAttribute("error").equals("error")) {
%>
<script type="text/javascript">
    alert("用户名或密码错误请重新登录!");
</script>
<%
    }
    session.setAttribute("error", "test");
%>
<div id="top">
    <font class="topc">宠物诊所</font>
</div>

<center>
    <div id="content">
        <form action="servlet/loginservlet" method="post" onsubmit="return checkId()">
            <table border="0" cellpadding="0" cellspacing="2" class="tab1">
                <tr align="center">
                    <td>用户名</td>
                    <td><input type="text" name="username" id="in1"/></td>
                </tr>
                <tr align="center">
                    <td>&nbsp;</td>
                    <td><input type="password" name="password" id="in3"/></td>
                </tr>
                <tr>
                    <td align="center" colspan="2">
                        <input type="submit" value="登录" id="in2"/>
                        <input type="reset" value="重置" id="in2"/>
                        <a href="adduser.jsp"><font color="gray" size="3"><i>注册</i></font></a>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</center>

<!-- include footer -->
<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>

adduser.jsp

<%@ page language="java" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>注册</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/css.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        #content {
            position: relative;
            top: 3px;
            width: 80%;
            height: 380px;
            margin: auto;
            overflow: hidden;
            z-index: 2;
        }

        .tab1 {
            position: relative;
            top: 60px;
            font-size: 24px;
        }

        #in1, #in2, #in3, #in4 {
            width: 250px;
            height: 30px;
            font-size: 24px;
        }

        #in5 {
            width: 80px;
            height: 28px;
            margin-top: 10px;
        }
    </style>
    <script type="text/javascript">
        function checkId() {
            if (document.getElementById("in1").value == ""
                && document.getElementById("in3").value == "" && document.getElementById("in2").value == "") {
                alert("请输入注册用户名和密码!");
                return false;
            } else if (document.getElementById("in1").value == "") {
                alert("请输入用户名");
                return false;
            } else if (document.getElementById("in3").value == "") {
                alert("请输入密码!");
                return false;
            } else if (document.getElementById("in2").value == "") {
                alert("请输入确认密码!");
                return false;
            } else if (document.getElementById("in3").value != document.getElementById("in2").value) {
                alert("您两次的密码不相同!");
                document.getElementById("in2").value = "";
                document.getElementById("in3").value = "";
                return false;
            } else {
                return true;
            }
        }
    </script>
</head>
<body>
<div id="top">
    <font class="topc">注册</font>
</div>

<center>
    <div id="content">
        <br/>
        <form action="servlet/addUserSer" method="post" onsubmit="return checkId()">
            <table border="0" cellpadding="0" cellspacing="2" class="tab1">
                <tr align="center">
                    <td>用户名&nbsp;</td>
                    <td><input type="text" name="name" id="in1"/>*
                    </td>
                </tr>
                <tr align="center">
                    <td>密 码&nbsp;</td>
                    <td><input type="password" name="password" id="in3"/>*
                    </td>
                </tr>
                <tr align="center">
                    <td>确认密码&nbsp;</td>
                    <td><input type="password" id="in2"/>*
                    </td>
                </tr>
                <tr align="center">
                    <td>电 话&nbsp;</td>
                    <td><input type="text" name="phone" id="in4"/>&nbsp;&nbsp;
                    </td>
                </tr>
                <tr align="center">
                    <td colspan="2">
                        <input type="submit" value="提交" id="in5"/>
                        <input type="reset" value="重置" id="in5"/>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</center>

<!-- include footer -->
<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>

adderr.jsp

<%@ page language="java" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>失败</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/css.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        #content {
            position: relative;
            top: 3px;
            width: 80%;
            height: 380px;
            margin: auto;
            overflow: hidden;
            font-size: 30px;
            z-index: 2;
        }
    </style>
</head>
<body>
<div id="top">
    <font class="topc">注册失败</font>
</div>

<center>
    <div id="content">
        <br/><br/>
        <br/>(╯﹏╰) 注册失败,返回重新注册 <a href="adduser.jsp">
        <font color="blue">
            <i>返回</i>
        </font>
    </a>
    </div>
</center>

<!-- include footer -->
<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>

addsuc.jsp

<%@ page language="java" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>恭喜注册成功</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="refresh" content="3;url=../init.jsp">
    <link href="css/css.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        #content {
            position: relative;
            top: 3px;
            width: 80%;
            height: 380px;
            margin: auto;
            overflow: hidden;
            font-size: 30px;
            z-index: 2;
        }
    </style>
</head>
<body>
<div id="top">
    <font class="topc">注册成功</font>
</div>

<center>
    <div id="content">
        <br/><br/>
        <br/> (*^__^*)恭喜您注册成功!3s后返回登录页面 <a href="init.jsp">
        <font color="red">
            <i>立即返回</i>
        </font>
    </a>
    </div>
</center>

<!-- include footer -->
<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>

petadd.jsp

<%@ page language="java" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>宠物新增</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/css.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        #content {
            position: relative;
            top: 3px;
            width: 80%;
            height: 380px;
            margin: auto;
            overflow: hidden;
            z-index: 2;
        }

        .tab1 {
            position: relative;
            top: 60px;
            font-size: 24px;
        }

        #in1, #in2, #in3, #in4 ,#in6{
            width: 250px;
            height: 30px;
            font-size: 24px;
        }

        #in5 {
            width: 80px;
            height: 28px;
            margin-top: 10px;
        }
    </style>
    <script type="text/javascript">
        function checkId() {
            if (document.getElementById("in1").value == ""
                && document.getElementById("in3").value == ""
                && document.getElementById("in2").value == ""
                && document.getElementById("in6").value == "") {
                alert("请输入宠物名相关信息!");
                return false;
            } else if (document.getElementById("in1").value == "") {
                alert("请输入宠物名!");
                return false;
            } else if (document.getElementById("in3").value == "") {
                alert("请输入主人!");
                return false;
            }else if (document.getElementById("in6").value == "") {
                alert("请输入电话!");
                return false;
            }
            else {
                return true;
            }
        }
    </script>
</head>
<body>

<jsp:include page="top.jsp"></jsp:include>
<!-- include top -->

<center>
    <div id="content">
        <br/>
        <form action="servlet/petadd" method="post" onsubmit="return checkId()">
            <table border="0" cellpadding="0" cellspacing="2" class="tab1">
                <tr align="center">
                    <td>宠物名&nbsp;</td>
                    <td><input type="text" name="petname" id="in1"/>*
                    </td>
                </tr>
                <tr align="center">
                    <td>主人&nbsp;</td>
                    <td><input type="text" name="petmaster" id="in3"/>*
                    </td>
                </tr>
                <tr align="center">
                    <td>城市&nbsp;</td>
                    <td><input type="text" name="petcity" id="in4"/>&nbsp;&nbsp;
                    </td>
                </tr>
                <tr align="center">
                    <td>地址&nbsp;</td>
                    <td><input type="text" name="petadress" id="in2"/>&nbsp;&nbsp;
                    </td>
                </tr>
                <tr align="center">
                    <td>电话&nbsp;</td>
                    <td><input type="text" name="petphone" id="in6"/>*
                    </td>
                </tr>

                <tr align="center">
                    <td colspan="2">
                        <input type="submit" value="提交" id="in5"/>
                        <input type="reset" value="重置" id="in5"/>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</center>

<!-- include footer -->
<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>

petupdate.jsp

<%@ page language="java" import="cn.dao.UserBean" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>宠物修改</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/css.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        #content {
            position: relative;
            top: 3px;
            width: 80%;
            height: 380px;
            margin: auto;
            overflow: hidden;
            z-index: 2;
        }

        .tab1 {
            position: relative;
            top: 60px;
            font-size: 24px;
        }

        #in1, #in2, #in3, #in4 ,#in6{
            width: 250px;
            height: 30px;
            font-size: 24px;
        }

        #in5 {
            width: 80px;
            height: 28px;
            margin-top: 10px;
        }
    </style>
    <script type="text/javascript">
        function checkId() {
            if (document.getElementById("in1").value == ""
                && document.getElementById("in3").value == ""
                && document.getElementById("in2").value == ""
                && document.getElementById("in6").value == "") {
                alert("请输入宠物名相关信息!");
                return false;
            } else if (document.getElementById("in1").value == "") {
                alert("请输入宠物名!");
                return false;
            } else if (document.getElementById("in3").value == "") {
                alert("请输入主人!");
                return false;
            } else if (document.getElementById("in6").value == "") {
                alert("请输入电话!");
                return false;
            }else {
                return true;
            }
        }
    </script>
</head>
<body>

<jsp:include page="top.jsp"></jsp:include>
<!-- include top -->

<%
    UserBean user = (UserBean) request.getAttribute("user");
%>

<center>
    <div id="content">
        <br/>
        <form action="servlet/petupdate" method="post" onsubmit="return checkId()">
            <table border="0" cellpadding="0" cellspacing="2" class="tab1">
                <tr align="center">
                    <td>宠物名&nbsp;</td>
                    <td><input type="text" name="petname" id="in1" value=<%=user.getPetname()%>>*
                    </td>
                </tr>
                <tr align="center">
                    <td>主人&nbsp;</td>
                    <td><input type="text" name="petmaster" id="in3" value=<%=user.getPetmaster()%>>*
                    </td>
                </tr>
                <tr align="center">
                    <td>城市&nbsp;</td>
                    <td><input type="text" name="petcity" id="in2"
                               value=<% if(user.getPetcity()==null){out.print(" ");}else{out.print(user.getPetcity());} %>>&nbsp;&nbsp;
                    </td>
                </tr>
                <tr align="center">
                    <td>地址&nbsp;</td>
                    <td><input type="text" name="petadress" id="in4"
                               value=<% if(user.getPetadress()==null){out.print(" ");}else{out.print(user.getPetadress());} %>>&nbsp;&nbsp;
                    </td>
                </tr>
                <tr align="center">
                    <td>电话&nbsp;</td>
                    <td><input type="text" name="petphone" id="in6"
                               value=<% if(user.getPetphone()==null){out.print(" ");}else{out.print(user.getPetphone());} %>>*
                    </td>
                </tr>
                <tr align="center">
                    <td colspan="2">
                        <input type="hidden" name="id" value=<%=user.getId() %>>
                        <input type="submit" value="提交" id="in5"/>
                        <input type="reset" value="重置" id="in5"/>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</center>

<!-- include footer -->
<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>

petsearch.jsp

<%@ page language="java" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>宠物查询</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/css.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        #content {
            position: relative;
            top: 3px;
            width: 80%;
            height: 380px;
            margin: auto;
            overflow: hidden;
            z-index: 2;
        }

        .tab1 {
            position: relative;
            top: 120px;
            font-size: 24px;
        }

        #in1 {
            width: 250px;
            height: 30px;
            font-size: 24px;
        }

        #in3 {
            width: 250px;
            height: 30px;
            font-size: 24px;
        }

        #in2 {
            width: 80px;
            height: 28px;
        }
    </style>
    <script type="text/javascript">
        function checkId() {
            if (document.getElementById("in1").value == ""
                && document.getElementById("in3").value == "") {
                alert("请输入宠物名或所有者名!");
                return false;
            } else if (document.getElementById("in1").value != ""
                && document.getElementById("in3").value != "") {
                alert("模糊查询只能输入一个!");
                return false;
            } else {
                return true;
                ;
            }
        }
    </script>
</head>
<body>
<jsp:include page="top.jsp"></jsp:include>
<!-- include top -->

<center>
    <div id="content">
        <form action="servlet/petquery" method="post" onsubmit="return checkId()">
            <table border="0" cellpadding="0" cellspacing="2" class="tab1">
                <tr align="center">
                    <td>宠物名:</td>
                    <td><input type="text" name="petname" id="in1"/></td>
                </tr>
                <tr align="center">
                    <td>&nbsp;人:</td>
                    <td><input type="text" name="petmaster" id="in3"/></td>
                </tr>
                <tr>
                    <td align="center" colspan="2">
                        <input type="submit" value="查询" id="in2"/>
                        <input type="reset" value="重置" id="in2"/>
                        <a href="petadd.jsp"><i><font color="gray" size="3" id="in2">添加</font></i></a>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</center>

<!-- include footer -->
<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>

docadd.jsp

<%@ page language="java" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>医生新增</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/css.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        #content {
            position: relative;
            top: 3px;
            width: 80%;
            height: 380px;
            margin: auto;
            overflow: hidden;
            z-index: 2;
        }

        .tab1 {
            position: relative;
            top: 60px;
            font-size: 24px;
        }

        #in1, #in2, #in3, #in4 {
            width: 250px;
            height: 30px;
            font-size: 24px;
        }

        #in5 {
            width: 80px;
            height: 28px;
            margin-top: 10px;
        }
    </style>
    <script type="text/javascript">
        function checkId() {
            if (document.getElementById("in1").value == ""
                && document.getElementById("in3").value == "" && document.getElementById("in2").value == "") {
                alert("请输入兽医姓名和专业!");
                return false;
            } else if (document.getElementById("in1").value == "") {
                alert("请输入姓名");
                return false;
            } else if (document.getElementById("in3").value == "") {
                alert("请输入专业!");
                return false;
            } else {
                return true;
            }
        }
    </script>
</head>
<body>

<jsp:include page="top.jsp"></jsp:include>
<!-- include top -->

<center>
    <div id="content">
        <br/>
        <form action="servlet/docadd" method="post" onsubmit="return checkId()">
            <table border="0" cellpadding="0" cellspacing="2" class="tab1">
                <tr align="center">
                    <td>姓名&nbsp;</td>
                    <td><input type="text" name="name" id="in1"/>*
                    </td>
                </tr>
                <tr align="center">
                    <td>专业&nbsp;</td>
                    <td><input type="text" name="major" id="in3"/>*
                    </td>
                </tr>
                <tr align="center">
                    <td>电话&nbsp;</td>
                    <td><input type="text" name="phone" id="in2"/>&nbsp;&nbsp;
                    </td>
                </tr>
                <tr align="center">
                    <td>地址&nbsp;</td>
                    <td><input type="text" name="address" id="in4"/>&nbsp;&nbsp;
                    </td>
                </tr>
                <tr align="center">
                    <td colspan="2">
                        <input type="submit" value="提交" id="in5"/>
                        <input type="reset" value="重置" id="in5"/>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</center>

<!-- include footer -->
<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>

docupdate.jsp

<%@ page language="java" import="cn.dao.UserBean" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>医生修改</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/css.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        #content {
            position: relative;
            top: 3px;
            width: 80%;
            height: 380px;
            margin: auto;
            overflow: hidden;
            z-index: 2;
        }

        .tab1 {
            position: relative;
            top: 60px;
            font-size: 24px;
        }

        #in1, #in2, #in3, #in4 {
            width: 250px;
            height: 30px;
            font-size: 24px;
        }

        #in5 {
            width: 80px;
            height: 28px;
            margin-top: 10px;
        }
    </style>
    <script type="text/javascript">
        function checkId() {
            if (document.getElementById("in1").value == ""
                && document.getElementById("in3").value == "" && document.getElementById("in2").value == "") {
                alert("请输入兽医姓名和专业!");
                return false;
            } else if (document.getElementById("in1").value == "") {
                alert("请输入姓名");
                return false;
            } else if (document.getElementById("in3").value == "") {
                alert("请输入专业!");
                return false;
            } else {
                return true;
            }
        }
    </script>
</head>
<body>

<jsp:include page="top.jsp"></jsp:include>
<!-- include top -->

<%
    UserBean user = (UserBean) request.getAttribute("user");
%>

<center>
    <div id="content">
        <br/>
        <form action="servlet/docupdate" method="post" onsubmit="return checkId()">
            <table border="0" cellpadding="0" cellspacing="2" class="tab1">
                <tr align="center">
                    <td>姓名&nbsp;</td>
                    <td><input type="text" name="name" id="in1" value=<%=user.getDocname()%>>*
                    </td>
                </tr>
                <tr align="center">
                    <td>专业&nbsp;</td>
                    <td><input type="text" name="major" id="in3" value=<%=user.getDocmajor()%>>*
                    </td>
                </tr>
                <tr align="center">
                    <td>电话&nbsp;</td>
                    <td><input type="text" name="phone" id="in2"
                               value=<% if(user.getDocphone()==null){out.print(" ");}else{out.print(user.getDocphone());} %>>&nbsp;&nbsp;
                    </td>
                </tr>
                <tr align="center">
                    <td>地址&nbsp;</td>
                    <td><input type="text" name="address" id="in4"
                               value=<% if(user.getDocadress()==null){out.print(" ");}else{out.print(user.getDocadress());} %>>&nbsp;&nbsp;
                    </td>
                </tr>
                <tr align="center">
                    <td colspan="2">
                        <input type="hidden" name="id" value=<%=user.getId() %>>
                        <input type="submit" value="提交" id="in5"/>
                        <input type="reset" value="重置" id="in5"/>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</center>

<!-- include footer -->
<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>

docsearch.jsp

<%@ page language="java" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>医生查询</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/css.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        #content {
            position: relative;
            top: 3px;
            width: 80%;
            height: 380px;
            margin: auto;
            overflow: hidden;
            z-index: 2;
        }

        .tab1 {
            position: relative;
            top: 120px;
            font-size: 24px;
        }

        #in1 {
            width: 250px;
            height: 30px;
            font-size: 24px;
        }

        #in3 {
            width: 250px;
            height: 30px;
            font-size: 24px;
        }

        #in2 {
            width: 80px;
            height: 28px;
        }
    </style>
    <script type="text/javascript">
        function checkId() {
            if (document.getElementById("in1").value == ""
                && document.getElementById("in3").value == "") {
                alert("请输入兽医名或专业!");
                return false;
            } else if (document.getElementById("in1").value != ""
                && document.getElementById("in3").value != "") {
                alert("少年,两个都输了,您这是要闹哪样啊!");
                return false;
            } else {
                return true;
                ;
            }
        }
    </script>
</head>
<body>
<script type="text/javascript">
    <%
    if(session.getAttribute("update").equals("del")){
        %>
    alert("删除成功!");
    <%
}else if(session.getAttribute("update").equals("delno")){
     %>
    alert("删除失败 !");
    <%
 }else if(session.getAttribute("update").equals("suc")){
     %>
    alert("添加成功 !");
    <%
 }else if(session.getAttribute("update").equals("err")){
     %>
    alert("添加失败 !");
    <%
    }else if(session.getAttribute("update").equals("ok")){
     %>
    alert("编辑成功 !");
    <%
    }
    session.setAttribute("update", "null");
      %>
    <%
    if(session.getAttribute("error").equals("cuo")){
    %>
    alert("出错了!");
    <% }
    session.setAttribute("error", "test");
     %>
</script>

<jsp:include page="top.jsp"></jsp:include>
<!-- include top -->

<center>
    <div id="content">
        <form action="servlet/docquery" method="post" onsubmit="return checkId()">
            <table border="0" cellpadding="0" cellspacing="2" class="tab1">
                <tr align="center">
                    <td>兽医姓名:</td>
                    <td><input type="text" name="docname" id="in1"/></td>
                </tr>
                <tr align="center">
                    <td>&nbsp;业:</td>
                    <td><input type="text" name="docmajor" id="in3"/></td>
                </tr>
                <tr>
                    <td align="center" colspan="2">
                        <input type="submit" value="查询" id="in2"/>
                        <input type="reset" value="重置" id="in2"/>
                        <a href="docadd.jsp"><i><font color="gray" size="3" id="in2">添加</font></i></a>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</center>

<!-- include footer -->
<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>

2.后端

DBConn

package cn.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class DocManage {
    // 空构造方法
    public DocManage() {
    }

    // 添加兽医
    public int addPetdoc(UserBean user) {
        String sql = "INSERT INTO petdoctor(docname,docmajor,docphone,docadress) VALUES (?,?,?,?)";
        int i = 0;
        try {
            DBConn.prepareConnection();
            DBConn.con.setAutoCommit(false);
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setString(1, user.getDocname());
            DBConn.ps.setString(2, user.getDocmajor());
            DBConn.ps.setString(3, user.getDocphone());
            DBConn.ps.setString(4, user.getDocadress());
            i = DBConn.ps.executeUpdate();
            DBConn.con.commit();
        } catch (SQLException e) {
            DBConn.rollback();
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return i;
    }

    // 删除兽医
    public int delPetdocForId(UserBean user) {
        String sql = "DELETE FROM petdoctor WHERE id=?";
        int i = 0;
        try {
            DBConn.prepareConnection();
            DBConn.con.setAutoCommit(false);
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setInt(1, user.getId());
            i = DBConn.ps.executeUpdate();
            DBConn.con.commit();
        } catch (SQLException e) {
            DBConn.rollback();
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return i;
    }

    // 通过id删除兽医
    public int delPetdocForId(int id) {
        String sql = "DELETE FROM petdoctor WHERE id=?";
        int i = 0;
        try {
            DBConn.prepareConnection();
            DBConn.con.setAutoCommit(false);
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setInt(1, id);
            i = DBConn.ps.executeUpdate();
            DBConn.con.commit();
        } catch (SQLException e) {
            DBConn.rollback();
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return i;
    }

    // 更新兽医
    public int updatePetdocForId(UserBean user) {
        String sql = "UPDATE petdoctor SET docname=?, docmajor=?,docphone=?,docadress=? WHERE id=?";
        int i = 0;
        try {
            DBConn.prepareConnection();
            DBConn.con.setAutoCommit(false);
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setString(1, user.getDocname());
            DBConn.ps.setString(2, user.getDocmajor());
            DBConn.ps.setString(3, user.getDocphone());
            DBConn.ps.setString(4, user.getDocadress());
            DBConn.ps.setInt(5, user.getId());
            i = DBConn.ps.executeUpdate();
            DBConn.con.commit();
        } catch (SQLException e) {
            DBConn.rollback();
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return i;
    }

    // 获取所有兽医
    public List<UserBean> getAllPetdoc() {
        String sql = "SELECT * FROM petdoctor";
        List<UserBean> users = new ArrayList<UserBean>();
        try {
            DBConn.prepareConnection();
            DBConn.ps = DBConn.con.prepareStatement(sql);
            ResultSet rs = DBConn.ps.executeQuery();
            while (rs.next()) {
                UserBean user = new UserBean();
                user.setId(rs.getInt("id"));
                user.setDocname(rs.getString("docname"));
                user.setDocmajor(rs.getString("docmajor"));
                user.setDocphone(rs.getString("docphone"));
                user.setDocadress(rs.getString("docadress"));
                users.add(user);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return users;
    }

    // 通过兽医名获取兽医
    public List<UserBean> getPetdocForName(UserBean use) {
        String sql = "SELECT * FROM petdoctor WHERE docname=?";
        List<UserBean> users = new ArrayList<UserBean>();
        try {
            DBConn.prepareConnection();
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setString(1, use.getDocname());
            ResultSet rs = DBConn.ps.executeQuery();
            while (rs.next()) {
                UserBean user = new UserBean();
                user.setId(rs.getInt("id"));
                user.setDocname(rs.getString("docname"));
                user.setDocmajor(rs.getString("docmajor"));
                user.setDocphone(rs.getString("docphone"));
                user.setDocadress(rs.getString("docadress"));
                users.add(user);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return users;
    }

    // 通过兽医专业获取兽医
    public List<UserBean> getPetdocForMajor(UserBean use) {
        String sql = "SELECT * FROM petdoctor WHERE docmajor=?";
        List<UserBean> users = new ArrayList<UserBean>();
        try {
            DBConn.prepareConnection();
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setString(1, use.getDocmajor());
            ResultSet rs = DBConn.ps.executeQuery();
            while (rs.next()) {
                UserBean user = new UserBean();
                user.setId(rs.getInt("id"));
                user.setDocname(rs.getString("docname"));
                user.setDocmajor(rs.getString("docmajor"));
                user.setDocphone(rs.getString("docphone"));
                user.setDocadress(rs.getString("docadress"));
                users.add(user);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return users;
    }

    // 通过兽医id获取兽医
    public UserBean getPetdocForId(int id) {
        String sql = "SELECT * FROM petdoctor WHERE id=?";
        UserBean user = new UserBean();
        try {
            DBConn.prepareConnection();
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setInt(1, id);
            ResultSet rs = DBConn.ps.executeQuery();
            while (rs.next()) {
                user.setId(rs.getInt("id"));
                user.setDocname(rs.getString("docname"));
                user.setDocmajor(rs.getString("docmajor"));
                user.setDocphone(rs.getString("docphone"));
                user.setDocadress(rs.getString("docadress"));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return user;
    }

    // 通过兽医名获取兽医
    public Integer getIdForName(UserBean user) {
        String sql = "SELECT * FROM petdoctor WHERE docname=?";
        Integer i = 0;
        try {
            DBConn.prepareConnection();
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setString(1, user.getLoginname());
            ResultSet rs = DBConn.ps.executeQuery();
            while (rs.next()) {
                i = rs.getInt("id");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return i;
    }
}

UserManage

package cn.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class UserManage {
    // 空构造方法
    public UserManage() {
    }

    // 添加用户
    public int addUser(UserBean user) {
        String sql = "INSERT INTO userinfo(username,password,userphone) VALUES (?,?,?)";
        int i = 0;
        try {
            DBConn.prepareConnection();
            DBConn.con.setAutoCommit(false);
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setString(1, user.getLoginname());
            DBConn.ps.setString(2, user.getLoginpassword());
            DBConn.ps.setString(3, user.getLoginphone());
            i = DBConn.ps.executeUpdate();
            DBConn.con.commit();
        } catch (SQLException e) {
            DBConn.rollback();
            System.out.println("插入数据失败!");
            i = 2;
        } finally {
            DBConn.close();
        }
        return i;
    }

    // 删除用户
    public int delUserForId(UserBean user) {
        String sql = "DELETE FROM userinfo WHERE id=?";
        int i = 0;
        try {
            DBConn.prepareConnection();
            DBConn.con.setAutoCommit(false);
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setInt(1, user.getId());
            i = DBConn.ps.executeUpdate();
            DBConn.con.commit();
        } catch (SQLException e) {
            DBConn.rollback();
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return i;
    }

    // 更新用户
    public int updateUseForId(UserBean user) {
        String sql = "UPDATE userinfo SET username=?, password=?,userphone=? WHERE id=?";
        int i = 0;
        try {
            DBConn.prepareConnection();
            DBConn.con.setAutoCommit(false);
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setString(1, user.getLoginname());
            DBConn.ps.setString(2, user.getLoginpassword());
            DBConn.ps.setString(3, user.getLoginphone());
            i = DBConn.ps.executeUpdate();
            DBConn.con.commit();
        } catch (SQLException e) {
            DBConn.rollback();
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return i;
    }

    // 获取所有用户
    public List<UserBean> getAllUsers() {
        String sql = "SELECT * FROM userinfo";
        List<UserBean> users = new ArrayList<UserBean>();
        try {
            DBConn.prepareConnection();
            DBConn.ps = DBConn.con.prepareStatement(sql);
            ResultSet rs = DBConn.ps.executeQuery();
            while (rs.next()) {
                UserBean user = new UserBean();
                user.setId(rs.getInt("id"));
                user.setLoginname(rs.getString("username"));
                user.setLoginpassword(rs.getString("password"));
                user.setLoginphone(rs.getString("userphone"));
                users.add(user);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return users;
    }

    // 通过登录名获取id
    public Integer getIdForName(UserBean user) {
        String sql = "SELECT * FROM userinfo WHERE username=?";
        Integer i = 0;
        try {
            DBConn.prepareConnection();
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setString(1, user.getLoginname());
            ResultSet rs = DBConn.ps.executeQuery();
            while (rs.next()) {
                i = rs.getInt("id");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return i;
    }

    // 检查用户登录
    public boolean userLogin(UserBean user) {
        String sql = "SELECT * FROM userinfo WHERE username=?";
        boolean flag = false;
        try {
            DBConn.prepareConnection();
            DBConn.ps = DBConn.con.prepareStatement(sql);
            DBConn.ps.setString(1, user.getLoginname());
            ResultSet rs = DBConn.ps.executeQuery();
            while (rs.next()) {
                if (rs.getString("password").equals(user.getLoginpassword()))
                    flag = true;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DBConn.close();
        }
        return flag;
    }
}

petAdd

package petservlets;

import cn.dao.DocManage;
import cn.dao.PetManage;
import cn.dao.UserBean;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author shuijianshiqing
 * @date 2021/1/24 11:16
 */
public class petAdd  extends HttpServlet {

    public petAdd() {
        super();
    }

    public void destroy() {
        super.destroy();
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        request.setCharacterEncoding("utf-8");
        UserBean user = new UserBean();
        user.setPetname(request.getParameter("petname"));
        user.setPetmaster(request.getParameter("petmaster"));
        user.setPetcity(request.getParameter("petcity"));
        user.setPetadress(request.getParameter("petadress"));
        user.setPetphone(request.getParameter("petphone"));
        PetManage manage = new PetManage();
        HttpSession session = request.getSession();
        if (manage.addPet(user) == 1) {
            session.setAttribute("update", "suc");
            request.getRequestDispatcher("../petsearch.jsp").forward(request, response);
        } else {
            session.setAttribute("update", "err");
            request.getRequestDispatcher("../petsearch.jsp").forward(request, response);
        }
        out.flush();
        out.close();
    }


    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        doGet(request, response);
    }


    public void init() throws ServletException {
        // Put your code here
    }
}

petDel

package petservlets;

import cn.dao.PetManage;
import cn.dao.UserBean;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author shuijianshiqing
 * @date 2021/1/24 11:31
 */
public class petDel  extends HttpServlet {

    public petDel() {
        super();
    }


    public void destroy() {
        super.destroy();
        // Put your code here
    }


    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        request.setCharacterEncoding("utf-8");
        String mode = request.getParameter("m");
        Integer id = Integer.parseInt(request.getParameter("id"));
        HttpSession session = request.getSession();
        PetManage manage = new PetManage();
        if (mode.equals("del")) {
            if (manage.delPetById(id) == 1) {
                session.setAttribute("update", "del");
            } else {
                session.setAttribute("update", "delno");
            }
            request.getRequestDispatcher("../petsearch.jsp").forward(request,
                    response);
        } else if (mode.equals("update")) {
            UserBean user = new UserBean();
            user = manage.getPetForId(id);
            if (!user.getPetname().equals("")) {
                request.setAttribute("user", user);
                request.getRequestDispatcher("../petupdate.jsp").forward(request,
                        response);
            } else {
                session.setAttribute("error", "cuo");
                request.getRequestDispatcher("../petsearch.jsp").forward(request, response);
            }
        }
        out.flush();
        out.close();
    }


    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        response.setContentType("text/html");
        PrintWriter out = response.getWriter();

        out.flush();
        out.close();
    }


    public void init() throws ServletException {
        // Put your code here
    }
}

petQuery

package petservlets;

import cn.dao.PetManage;
import cn.dao.UserBean;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

/**
 * @author shuijianshiqing
 * @date 2021/1/24 11:31
 */
public class petQuery extends HttpServlet {

    public petQuery() {
        super();
    }


    public void destroy() {
        super.destroy();
        // Put your code here
    }


    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        doPost(request, response);
    }


    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        request.setCharacterEncoding("utf-8");
        String name = request.getParameter("petname");
        String master = request.getParameter("petmaster");
        UserBean user = new UserBean();
        PetManage manage = new PetManage();
        List<UserBean> list = new ArrayList<UserBean>();
        request.setAttribute("nopet", "flase");

        if (master.equals("")) {
            list = manage.getPetdocForName(name);
            request.setAttribute("list", list);
            // 无数据时返回提示
            if (list.size() == 0) {
                request.setAttribute("nopet", "nopet");
            }
            request.getRequestDispatcher("../petresult.jsp").forward(request, response);
        } else {
            user.setPetmaster(master);
            list = manage.getPetByMaster(user);
            request.setAttribute("list", list);
            if (list.size() == 0) {
                request.setAttribute("nopet", "nopet");
            }
            request.getRequestDispatcher("../petresult.jsp").forward(request, response);
        }
        out.flush();
        out.close();
    }


    public void init() throws ServletException {
        // Put your code here
    }
}

petUpdate

package petservlets;

import cn.dao.PetManage;
import cn.dao.UserBean;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author shuijianshiqing
 * @date 2021/1/24 11:31
 */
public class petUpdate extends HttpServlet {

    public petUpdate() {
        super();
    }


    public void destroy() {
        super.destroy();
        // Put your code here
    }


    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        response.setContentType("text/html");
        PrintWriter out = response.getWriter();

        out.flush();
        out.close();
    }


    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        request.setCharacterEncoding("utf-8");
        Integer id = Integer.parseInt(request.getParameter("id"));
        String petname = request.getParameter("petname");
        String petmaster = request.getParameter("petmaster");
        String petcity = request.getParameter("petcity");
        String petadress = request.getParameter("petadress");
        String petphone = request.getParameter("petphone");




        UserBean user = new UserBean();
        PetManage manage = new PetManage();
        HttpSession session = request.getSession();

        user.setId(id);
        user.setPetname(petname);
        user.setPetmaster(petmaster);
        user.setPetcity(petcity);
        user.setPetadress(petadress);
        user.setPetphone(petphone);
        if (manage.updatePetForId(user) == 1) {
            session.setAttribute("update", "ok");
        } else {
            session.setAttribute("error", "ng");
        }
        request.getRequestDispatcher("../petsearch.jsp").forward(request, response);
        out.flush();
        out.close();
    }


    public void init() throws ServletException {
        // Put your code here
    }
}

四、其他

1.其他系统实现

Java+JSP实现学生图书管理系统
Java+JSP实现学生信息管理系统
Java+JSP实现用户信息管理系统
Java+Servlet+JSP实现航空订票系统
Java+Servlet+JSP实现房屋租赁管理系统
Java+Servlet+JSP实现学生选课管理系统
Java+Servlet+JSP实现学生成绩管理系统
Java+Servlet+JSP实现宠物诊所管理系统
Java+SSM+Easyui实现网上考试系统
Java+SSM+Bootstrap实现Web学生信息管理系统
Java+Springboot+H-ui实现营销管理系统
Java+Springboot+Mybatis+Bootstrap实现网上商城系统
Java+Springboot+Mybatis+Bootstrap实现景区旅游管理系统

2.获取源码

Java+JSP+Servlet+Mysql实现Web宠物诊所管理系统

3.备注

如有侵权请联系我删除。

  • 34
    点赞
  • 183
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 18
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 18
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

水坚石青

你的鼓励是我更新的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值