JavaWeb

bean

Book

package bean;

public class Book {
	private String id;
	private String name;
	private String publisher;
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPublisher() {
		return publisher;
	}
	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}
	@Override
	public String toString() {
		return "Book [id=" + id + ", name=" + name + ", publisher=" + publisher + "]";
	}
	public Book(String id, String name, String publisher) {
		super();
		this.id = id;
		this.name = name;
		this.publisher = publisher;
	}
	
}

User

package bean;

public class User {
	private String uname;
	private String usex;
	private String uage;
	private String udep;
	private String passwd;
	
	public User(String uname, String usex, String uage, String udep, String passwd) {
		super();
		this.uname = uname;
		this.usex = usex;
		this.uage = uage;
		this.udep = udep;
		this.passwd = passwd;
	}
	public String getPasswd() {
		return passwd;
	}
	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}
	public String getUname() {
		return uname;
	}
	public void setUname(String uname) {
		this.uname = uname;
	}
	public String getUsex() {
		return usex;
	}
	public void setUsex(String usex) {
		this.usex = usex;
	}
	public String getUage() {
		return uage;
	}
	public void setUage(String uage) {
		this.uage = uage;
	}
	public String getUdep() {
		return udep;
	}
	public void setUdep(String udep) {
		this.udep = udep;
	}
	@Override
	public String toString() {
		return "User [uname=" + uname + ", usex=" + usex + ", uage=" + uage + ", udep=" + udep + ", passwd=" + passwd
				+ "]";
	}
	
}

dao

Abooks

package dao;

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

import bean.Book;
import tools.JDBCUtils;

public class Abooks {
	public static List<Book> getallbooks(){
		List<Book> list=new ArrayList<Book>();
		try {
			Connection conn=JDBCUtils.getConnection();
			String sqlStr="select * from books";
			PreparedStatement pst = conn.prepareStatement(sqlStr);
			ResultSet rs = pst.executeQuery();
			while( rs!=null && rs.next()) {
				String id=rs.getString("id");
				String Bname=rs.getString("Bname");
				String publisher=rs.getString("publisher");
				Book book = new Book(id, Bname, publisher);
				list.add(book);
			}
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}
}

servlet

bookServlet

package servlet;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import bean.Book;
import dao.Abooks;

import dao.Abooks;
import tools.JDBCUtils;

/**
 * Servlet implementation class bookServlet
 */
@WebServlet("/bookServlet")
public class bookServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public bookServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String op = request.getParameter("op");
		String id=request.getParameter("id");
		String Bname=request.getParameter("Bname");
		String publisher=request.getParameter("publisher");
		if(op.contentEquals("add")) {
			try {
				Connection connection = JDBCUtils.getConnection();
				String strsql="insert into books values(?,?,?)";
				PreparedStatement pst = connection.prepareStatement(strsql);
				pst.setString(1, id);
				pst.setString(2, Bname);
				pst.setString(3, publisher);
				pst.executeUpdate();
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
		if(op.contentEquals("del")) {
			try {
				Connection connection = JDBCUtils.getConnection();
				String stsql="delete from books where id=? and Bname=? and publisher=?";
				PreparedStatement pst = connection.prepareStatement(stsql);
				pst.setString(1, id);
				pst.setString(2, Bname);
				pst.setString(3, publisher);
				pst.executeUpdate();
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		if(op.contentEquals("up")) {
			try {
				Connection connection = JDBCUtils.getConnection();
				String stsql="update books set id=?,Bname=?,publisher=? where id=? and Bname=? and publisher=?";
				PreparedStatement pst = connection.prepareStatement(stsql);
				pst.setString(1, id);
				pst.setString(2, Bname);
				pst.setString(3, publisher);
				pst.setString(4, request.getParameter("oldid"));
				pst.setString(5, request.getParameter("oldname"));
				pst.setString(6, request.getParameter("oldpublisher"));
				pst.executeUpdate();				
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			
		}
		List<Book> getallbooks = Abooks.getallbooks();
		request.setAttribute("allbooks", getallbooks);
		request.getRequestDispatcher("show.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

LoginServlet

package servlet;

import java.io.IOException;
import java.sql.*;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import bean.Book;

import dao.Abooks;
import tools.JDBCUtils;


/**
 * Servlet implementation class LoginServlet
 */
@WebServlet("/LoginServlet")
public class LoginServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public LoginServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			String uname=request.getParameter("username");
			String upasswd=request.getParameter("passwd");
			HttpSession session = request.getSession(true);
			session.setAttribute("username1", uname);
			session.setAttribute("passwd1", upasswd);
			try {
				Connection conn=JDBCUtils.getConnection();
				String sqlStr="select * from userinfo where uname=? and passwd=?";
				PreparedStatement pst = conn.prepareStatement(sqlStr);
				//这是sql的预编译语句
				//避免sql攻击
				pst.setString(1, uname);
				pst.setString(2, upasswd);//可以设置多种参数,有int,有float等
				ResultSet rs = pst.executeQuery();
				//注意正式执行sql语句的预编译对象的方法有三个,executeQuery,execute,executeUpdate,会得到一个结果集
				if(rs.next()) {
					List<Book> getallbooks = Abooks.getallbooks();
					request.setAttribute("allbooks", getallbooks);
					request.getRequestDispatcher("show.jsp").forward(request, response);
					JDBCUtils.release(pst, conn, rs);
				}
				else {
					response.sendRedirect("login.html");
				}
				
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

upuserservlet

package servlet;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import tools.JDBCUtils;

/**
 * Servlet implementation class upuserservlet
 */
@WebServlet("/upuserservlet")
public class upuserservlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public upuserservlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			String uname = request.getParameter("uname");
			String usex=request.getParameter("usex");
			String uage=request.getParameter("uage");
			String udep=request.getParameter("udep");
			String passwd=request.getParameter("passwd");
			Connection connection = JDBCUtils.getConnection();
			String stsql="update userinfo set uname=?,usex=?,uage=?,udep=?,passwd=? where uname=? and passwd=?";
			PreparedStatement pst = connection.prepareStatement(stsql);
			HttpSession session = request.getSession(true);
			String kname=(String) session.getAttribute("username1");
			String kpasswd=(String) session.getAttribute("passwd1");
			pst.setString(1, uname);
			pst.setString(2, usex);
			pst.setString(3, uage);
			pst.setString(4, udep);
			pst.setString(5, passwd);
			pst.setString(6, kname);
			pst.setString(7, kpasswd);
			System.out.println(kname);
			pst.executeUpdate();	
			request.getRequestDispatcher("login.html").forward(request, response);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

Userservlet

package servlet;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import tools.JDBCUtils;

/**
 * Servlet implementation class upuserservlet
 */
@WebServlet("/upuserservlet")
public class Userservlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Userservlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			String uname = request.getParameter("uname");
			String usex=request.getParameter("usex");
			String uage=request.getParameter("uage");
			String udep=request.getParameter("udep");
			String passwd=request.getParameter("passwd");
			Connection connection = JDBCUtils.getConnection();
			String stsql="update userinfo set uname=?,usex=?,uage=?,udep=?,passwd=? where uname=? and passwd=?";
			PreparedStatement pst = connection.prepareStatement(stsql);
			HttpSession session = request.getSession(true);
			String kname=(String) session.getAttribute("username1");
			String kpasswd=(String) session.getAttribute("passwd1");
			pst.setString(1, uname);
			pst.setString(2, usex);
			pst.setString(3, uage);
			pst.setString(4, udep);
			pst.setString(5, passwd);
			pst.setString(6, kname);
			pst.setString(7, kpasswd);
			System.out.println(kname);
			pst.executeUpdate();	
			request.getRequestDispatcher("login.html").forward(request, response);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

tools

JDBCUtils

package tools;

import java.sql.*;

public class JDBCUtils {
	public static Connection getConnection() throws ClassNotFoundException, SQLException  {
		Class.forName("com.mysql.jdbc.Driver");
		String url="jdbc:mysql://localhost:3306/test";
		String username="root";
		String password="root";
		Connection conn = DriverManager.getConnection(url, username, password);
		return conn;
	}
	public static void release(PreparedStatement prestmt, Connection conn,
			ResultSet rs) {
		if( prestmt != null ) {
			try {
				prestmt.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			prestmt=null;
		}
		if( rs != null ) {
			try {
				rs.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			rs=null;
		}
		if( conn != null ) {
			try {
				conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			conn=null;
		}
	}
}

WebContent

addbook.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<!-- CSS only -->
<link
	href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
	rel="stylesheet"
	integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
	crossorigin="anonymous">
<!-- JavaScript Bundle with Popper -->
<script
	src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
	integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
	crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
		<div class="row">
			<div class="col-sm">
				<div class="jumbotron jumbotron-fluid">
					<div class="container">
						<h1 class="display-4">Add Book</h1>
						<p class="lead">Please fill in the book information you need to add below!</p>
					</div>
				</div>
					<form action="/ptest/bookServlet?op=add" method="post">
					<div class="form-group">
						<label for="id">出版社编号</label> <input type="text"
							class="form-control" id="id" name="id"
							aria-describedby="emailHelp">
					</div>
					<div class="form-group">
						<label for="Bname"><br/>图书名称</label> <input type="text"
							class="form-control" id="Bname" name="Bname">
					</div>
					<div class="form-group">
						<label for="publisher"><br/>出版社名字</label> <input type="text"
							class="form-control" id="publisher" name="publisher">
					</div><br/>
					<button type="submit" class="btn btn-primary">Add</button>
				</form>
			</div>
		</div>
	</div>
</body>
</html>

dbook.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<!-- CSS only -->
<link
	href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
	rel="stylesheet"
	integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
	crossorigin="anonymous">
<!-- JavaScript Bundle with Popper -->
<script
	src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
	integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
	crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
		<div class="row">
			<div class="col-sm">
				<div class="jumbotron jumbotron-fluid">
					<div class="container">
						<h1 class="display-4">Delete Book</h1>
						<p class="lead">Please enter the book information you need to delete!</p>
					</div>
				</div>
					<form action="/ptest/bookServlet?op=del" method="post">
					<div class="form-group">
						<label for="id">出版社编号</label> <input type="text"
							class="form-control" id="id" name="id"
							aria-describedby="emailHelp">
					</div>
					<div class="form-group">
						<label for="Bname"><br/>图书名称</label> <input type="text"
							class="form-control" id="Bname" name="Bname">
					</div>
					<div class="form-group">
						<label for="publisher"><br/>出版社名字</label> <input type="text"
							class="form-control" id="publisher" name="publisher">
					</div><br/>
					<button type="submit" class="btn btn-primary">Delete</button>
				</form>
			</div>
		</div>
	</div>
</body>
</html>

login.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<!-- CSS only -->
<link
	href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
	rel="stylesheet"
	integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
	crossorigin="anonymous">
<!-- JavaScript Bundle with Popper -->
<script
	src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
	integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
	crossorigin="anonymous"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="col-sm">
				<div class="jumbotron jumbotron-fluid">
					<div class="container">
						<h1 class="display-4">Login Interface</h1>
						<p class="lead">Thank you for using and wish you a good day!</p>
					</div>
				</div>
				<form action="LoginServlet" method="post">
					<div class="form-group">
						<label for="Username">Username</label> <input type="text"
							class="form-control" id="username" name="username"
							aria-describedby="emailHelp">
					</div>
					<div class="form-group">
						<label for="passwd"><br/>Password</label> <input type="password"
							class="form-control" id="passwd" name="passwd">
					</div>
					<div class="form-group form-check">
						<input type="checkbox" class="form-check-input" id="exampleCheck1">
						<label class="form-check-label" for="exampleCheck1">Check
							me out</label>
					</div><br/>
					<button type="submit" class="btn btn-primary">Submit</button>
				</form>
			</div>
		</div>
	</div>
</body>
</html>

show.jsp

<%@ 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>
<!-- CSS only -->
<link
	href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
	rel="stylesheet"
	integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
	crossorigin="anonymous">
<!-- JavaScript Bundle with Popper -->
<script
	src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
	integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
	crossorigin="anonymous"></script>
</head>
<body>
<div class="jumbotron jumbotron-fluid">
  <div class="container">
    <h1 class="display-4">All Books</h1>
    <p class="lead">All the contents of all the books we have!</p>
  </div>
</div>
<table class="table table-hover">
  <thead>
    <tr>
      <th scope="col">序号</th>
      <th scope="col">编码</th>
      <th scope="col">书名</th>
      <th scope="col">出版社</th>
    </tr>
  </thead>
  <c:forEach items="${allbooks}" var="Book" varStatus="vs">
    <tbody>
    <tr>
      <th scope="row">${vs.index+1}</th>
      <td>${Book.id}</td>
      <td>${Book.name}</td>
      <td>${Book.publisher}</td>
    </tr>
  </tbody>
</c:forEach>
</table>
<ul class="nav nav-tabs">
  <li class="nav-item">
    <a class="nav-link active" href="addbook.html">添加图书</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="dbook.html">删除图书</a>
  </li>
  <li class="nav-item">
    <a class="nav-link"  href="upbook.html">修改图书图书</a>
  </li>
   <li class="nav-item">
    <a class="nav-link"  href="Userservlet">我的信息</a>
  </li>
</ul>
</body>
</html>

upbook.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<!-- CSS only -->
<link
	href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
	rel="stylesheet"
	integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
	crossorigin="anonymous">
<!-- JavaScript Bundle with Popper -->
<script
	src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
	integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
	crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
		<div class="row">
			<div class="col-sm">
				<div class="jumbotron jumbotron-fluid">
					<div class="container">
						<h1 class="display-4">Modify information</h1>
						<p class="lead">Please enter the book information you need to modify!</p>
					</div>
				</div>
					<form action="bookServlet?op=up" method="post">
					<div class="form-group">
						<label for="oldid">旧出版社编号</label> <input type="text"
							class="form-control" id="oldid" name="oldid"
							aria-describedby="emailHelp">
					</div>
					<div class="form-group">
						<label for="oldname"><br/>旧图书名称</label> <input type="text"
							class="form-control" id="oldname" name="oldname">
					</div>
					<div class="form-group">
						<label for="oldpublisher"><br/>旧出版社名字</label> <input type="text"
							class="form-control" id="oldpublisher" name="oldpublisher">
					</div><br/><br/><br/>
					<div class="form-group">
						<label for="id">新出版社编号</label> <input type="text"
							class="form-control" id="id" name="id"
							aria-describedby="emailHelp">
					</div>
					<div class="form-group">
						<label for="Bname"><br/>新图书名称</label> <input type="text"
							class="form-control" id="Bname" name="Bname">
					</div>
					<div class="form-group">
						<label for="publisher"><br/>新出版社名字</label> <input type="text"
							class="form-control" id="publisher" name="publisher">
					</div><br/>
					<button type="submit" class="btn btn-primary">Modify</button>
				</form>
			</div>
		</div>
	</div>
</body>
</html>

upinfo.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<!-- CSS only -->
<link
	href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
	rel="stylesheet"
	integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
	crossorigin="anonymous">
<!-- JavaScript Bundle with Popper -->
<script
	src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
	integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
	crossorigin="anonymous"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="col-sm">
				<div class="jumbotron jumbotron-fluid">
					<div class="container">
						<h1 class="display-4">Modify Information</h1>
						<p class="lead">Please check your information carefully!</p>
					</div>
				</div>
				<form action="upuserservlet" method="post">
					<div class="form-group">
						<label for="uname">Name</label> <input type="text"
							class="form-control" id="uname" name="uname"
							aria-describedby="emailHelp">
					</div><br/>
					<div class="form-group">
						<label for="usex">Gender</label> <input type="text"
							class="form-control" id="usex" name="usex"
							aria-describedby="emailHelp">
					</div><br/>
					<div class="form-group">
						<label for="uage">Age</label> <input type="text"
							class="form-control" id="uage" name="uage"
							aria-describedby="emailHelp">
					</div><br/>
					<div class="form-group">
						<label for="udep">Department</label> <input type="text"
							class="form-control" id="udep" name="udep"
							aria-describedby="emailHelp">
					</div>
					<div class="form-group">
						<label for="passwd"><br/>Password</label> <input type="text"
							class="form-control" id="passwd" name="passwd">
					</div>
					<div class="form-group form-check">
						<input type="checkbox" class="form-check-input" id="exampleCheck1">
						<label class="form-check-label" for="exampleCheck1">Check
							me out</label>
					</div><br/>
					<button type="submit" class="btn btn-primary">Submit</button>
				</form>
			</div>
		</div>
	</div>
</body>
</html>

userinf.jsp

目录

bean

Book

User

dao

Abook

servlet

bookServlet

LoginServlet

upuserservlet

Userservlet

tools

JDBCUtils

WebContent

addbook.html

dbook.html

login.html

show.jsp

upbook.html

upinfo.html

userinf.jsp


上一篇:enum类型的本质(转)


下一篇:18-MySQL-数据库连接池