<jsp:include page=“footer.jsp”></jsp:include>
<%@ page language=“java” pageEncoding=“UTF-8” %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + “😕/”
-
request.getServerName() + “:” + request.getServerPort()
-
path + “/”;
%>
<jsp:include page=“top.jsp”></jsp:include>
<jsp:include page=“footer.jsp”></jsp:include>
<%@ page language=“java” import=“cn.dao.UserBean” pageEncoding=“UTF-8” %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + “😕/”
-
request.getServerName() + “:” + request.getServerPort()
-
path + “/”;
%>
<jsp:include page=“top.jsp”></jsp:include>
<%
UserBean user = (UserBean) request.getAttribute(“user”);
%>
value=<% if(user.getPetcity()==null){out.print(" ");}else{out.print(user.getPetcity());} %>>
地址value=<% if(user.getPetadress()==null){out.print(" ");}else{out.print(user.getPetadress());} %>>
电话value=<% if(user.getPetphone()==null){out.print(" ");}else{out.print(user.getPetphone());} %>>*
<input type=“hidden” name=“id” value=<%=user.getId() %>>
<jsp:include page=“footer.jsp”></jsp:include>
<%@ page language=“java” pageEncoding=“UTF-8” %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + “😕/” + request.getServerName() + “:” + request.getServerPort() + path + “/”;
%>
<jsp:include page=“top.jsp”></jsp:include>
<jsp:include page=“footer.jsp”></jsp:include>
<%@ page language=“java” pageEncoding=“UTF-8” %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + “😕/”
-
request.getServerName() + “:” + request.getServerPort()
-
path + “/”;
%>
<jsp:include page=“top.jsp”></jsp:include>
<jsp:include page=“footer.jsp”></jsp:include>
<%@ page language=“java” import=“cn.dao.UserBean” pageEncoding=“UTF-8” %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + “😕/”
-
request.getServerName() + “:” + request.getServerPort()
-
path + “/”;
%>
<jsp:include page=“top.jsp”></jsp:include>
<%
UserBean user = (UserBean) request.getAttribute(“user”);
%>
value=<% if(user.getDocphone()==null){out.print(" ");}else{out.print(user.getDocphone());} %>>
地址value=<% if(user.getDocadress()==null){out.print(" ");}else{out.print(user.getDocadress());} %>>
<input type=“hidden” name=“id” value=<%=user.getId() %>>
<jsp:include page=“footer.jsp”></jsp:include>
<%@ page language=“java” pageEncoding=“UTF-8” %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + “😕/” + request.getServerName() + “:” + request.getServerPort() + path + “/”;
%>
<jsp:include page=“top.jsp”></jsp:include>
<jsp:include page=“footer.jsp”></jsp:include>
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 getAllPetdoc() {
String sql = “SELECT * FROM petdoctor”;
List users = new ArrayList();
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 getPetdocForName(UserBean use) {
String sql = “SELECT * FROM petdoctor WHERE docname=?”;
List users = new ArrayList();
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 getPetdocForMajor(UserBean use) {
String sql = “SELECT * FROM petdoctor WHERE docmajor=?”;
List users = new ArrayList();
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;
}
}
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 getAllUsers() {
String sql = “SELECT * FROM userinfo”;
List users = new ArrayList();
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;
}
}
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
}
}
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();
}
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:前端)
最后
前端校招精编面试解析大全点击这里免费获取完整版pdf查看
ws ServletException {
// Put your code here
}
}
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();
}
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
[外链图片转存中…(img-LMszCxAl-1713498003478)]
[外链图片转存中…(img-l9gNi2LI-1713498003478)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
[外链图片转存中…(img-CPZdqPCn-1713498003479)]
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:前端)
[外链图片转存中…(img-7iIDPb6E-1713498003479)]
最后
前端校招精编面试解析大全点击这里免费获取完整版pdf查看