Commit 33713f20 by [username]
parents 3358afa2 c7ac8552
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<dictionary name="lenovo"> <dictionary name="lenovo">
<words> <words>
<w>bookarray</w> <w>bookarray</w>
<w>bookname</w>
<w>booktojson</w> <w>booktojson</w>
<w>deaed</w> <w>deaed</w>
<w>fitler</w> <w>fitler</w>
......
import com.example.javaproject2.Login_compare; //import com.example.javaproject2.Login_compare;
//
import javax.servlet.ServletException; //import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet; //import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet; //import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; //import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; //import javax.servlet.http.HttpServletResponse;
import java.io.IOException; //import java.io.IOException;
import java.io.PrintWriter; //import java.io.PrintWriter;
import java.util.Iterator; //import java.util.Iterator;
//
import static java.awt.Color.*; //import static java.awt.Color.*;
//
//@WebServlet("/login") ////@WebServlet("/login")
public class LoginServlet extends HttpServlet { //public class LoginServlet extends HttpServlet {
//
@Override // @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8"); // req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8"); // resp.setCharacterEncoding("utf-8");
resp.setContentType("text/html"); // resp.setContentType("text/html");
String username = req.getParameter("username"); // String username = req.getParameter("username");
String password = req.getParameter("password"); // String password = req.getParameter("password");
PrintWriter out = resp.getWriter(); // PrintWriter out = resp.getWriter();
//
if (username.equals("")) { // if (username.equals("")) {
out.println("<h1>登陆失败!用户名为空!</h1>"); // out.println("<h1>登陆失败!用户名为空!</h1>");
} else if (password.equals("")) { // } else if (password.equals("")) {
out.println("<h1>登陆失败!密码为空!<h1>"); // out.println("<h1>登陆失败!密码为空!<h1>");
} else { // } else {
out.println(Login_compare.compare(username,password)); // out.println(Login_compare.compare(username,password));
switch(Login_compare.compare(username,password)){ // switch(Login_compare.compare(username,password)){
case 1: // case 1:
out.println("<h1>用户名或密码错误</h1>"); // out.println("<h1>用户名或密码错误</h1>");
break; // break;
case 2: // case 2:
out.println("<h1>登陆成功!!</h1>"); // out.println("<h1>登陆成功!!</h1>");
resp.sendRedirect("menu.jsp"); // resp.sendRedirect("menu.jsp");
break; // break;
} // }
} // }
} // }
@Override // @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp); // doGet(req, resp);
} // }
//
} //}
\ No newline at end of file \ No newline at end of file
...@@ -2,4 +2,15 @@ package com.Dao; ...@@ -2,4 +2,15 @@ package com.Dao;
public class AllToArray { public class AllToArray {
// int uuid;
//
// public int getUuid() {
// return uuid;
// }
//
// public void setUuid(int uuid) {
// this.uuid = uuid;
// }
} }
package com.Dao; package com.Dao;
import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
public class Books { public class Books {
...@@ -16,177 +16,6 @@ public class Books { ...@@ -16,177 +16,6 @@ public class Books {
String image; String image;
int borrow_times; int borrow_times;
/**
* 返回一个按借阅次数排列的书籍集合
* @param books_array
*/
public static void book_top_array(ArrayList<Books> books_array){
books_array.clear();
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
System.out.println("Creating statement book...");
stmt = conn.createStatement();
String sql = "SELECT * FROM books order by borrow_times desc";
ResultSet rs = stmt.executeQuery(sql);
conn.setAutoCommit(false);
while (rs.next()) {
String id = rs.getString("id");
int jdid = rs.getInt("jdid");
int bookshelf_id= rs.getInt("bookshelf_id");
int borrow_times = rs.getInt("borrow_times");
String book_name = rs.getString("book_name");
String category = rs.getString("category");
String author = rs.getString("author");
String publisher = rs.getString("publisher");
String image = rs.getString("image");
int books_same_id = rs.getInt("book_same_id");
Books.book_to_arr(id,jdid,bookshelf_id,book_name,books_same_id,category,author,publisher,image, borrow_times, books_array);
}
conn.commit();
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
/**
* 返回一个按数据库顺序排列的书籍集合
* @param books_array
*/
public static void books_to_array(ArrayList<Books> books_array){
books_array.clear();
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Connecting to database top...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql = "SELECT * FROM books ";
ResultSet rs = stmt.executeQuery(sql);
conn.setAutoCommit(false);
while (rs.next()) {
String id = rs.getString("id");
int jdid = rs.getInt("jdid");
int bookshelf_id= rs.getInt("bookshelf_id");
int borrow_times = rs.getInt("borrow_times");
String book_name = rs.getString("book_name");
String category = rs.getString("category");
String author = rs.getString("author");
String publisher = rs.getString("publisher");
String image = rs.getString("image");
int books_same_id = rs.getInt("book_same_id");
Books.book_to_arr(id,jdid,bookshelf_id,book_name,books_same_id,category,author,publisher,image, borrow_times, books_array);
}
conn.commit();
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
public static void book_to_arr(String id, int jdid, int bookshelf_id,
String book_name, int book_same_id,
String category, String author,
String publisher, String image,
int borrow_times, ArrayList<Books> books_array){
Books books = new Books();
books.id = id;
books.author = author;
books.jdid = jdid;
books.bookshelf_id = bookshelf_id;
books.book_name = book_name;
books.book_same_id = book_same_id;
books.category = category;
books.publisher = publisher;
books.image = image;
books.borrow_times = borrow_times;
books_array.add(books);
}
public int getJdid() { public int getJdid() {
...@@ -213,8 +42,6 @@ public class Books { ...@@ -213,8 +42,6 @@ public class Books {
this.book_name = book_name; this.book_name = book_name;
} }
public String getCategory() { public String getCategory() {
return category; return category;
} }
......
...@@ -16,94 +16,7 @@ public class Borrow { ...@@ -16,94 +16,7 @@ public class Borrow {
int is_return; int is_return;
int already_remind; int already_remind;
public static void borrow_to_array(ArrayList<Borrow> borrow_array){
borrow_array.clear();
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql = "SELECT * FROM borrow ";
ResultSet rs = stmt.executeQuery(sql);
conn.setAutoCommit(false);
while (rs.next()) {
String user_id = rs.getString("user_id");
String borrow_id = rs.getString("borrow_id");
String manage_id = rs.getString("manage_id");
String book_id = rs.getString("book_id");
String username = rs.getString("username");
String book_name = rs.getString("book_name");
String borrow_time = rs.getString("borrow_time");
int is_return = rs.getInt("is_return");
int already_remind = rs.getInt("already_remind");
Borrow.borrow_to_arr(user_id,borrow_id,manage_id,book_id,username,book_name,borrow_time,is_return,already_remind,borrow_array);
}
conn.commit();
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try id,user_uuid,borrow_uuid,manage_uuid,book_uuid,username,book_name,borrow_time,is_return
}
public static void borrow_to_arr(String user_id, String borrow_id,
String manage_id, String book_id,
String username,String book_name,String borrow_time,
int is_return,int already_remind,ArrayList<Borrow> borrow_array){
Borrow borrow = new Borrow();
borrow.borrow_id = borrow_id;
borrow.username = username;
borrow.user_id = user_id;
borrow.book_name = book_name;
borrow.book_id = book_id;
borrow.manage_id = manage_id;
borrow.borrow_time = borrow_time;
borrow.is_return = is_return;
borrow.already_remind = already_remind;
borrow_array.add(borrow);
}
......
package com.Dao;
public class ReturnBook {
}
...@@ -8,10 +8,28 @@ public class Return_before { ...@@ -8,10 +8,28 @@ public class Return_before {
private String manage_id; private String manage_id;
private String book_id; private String book_id;
private String book_name; private String book_name;
private String user_name;
private String borrow_time; private String borrow_time;
private int jdid; private int jdid;
private int bookshelf_id; private int bookshelf_id;
private int book_same_id; private int book_same_id;
private String return_time;
public String getReturn_time() {
return return_time;
}
public void setReturn_time(String return_time) {
this.return_time = return_time;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUser_id() { public String getUser_id() {
return user_id; return user_id;
......
...@@ -14,85 +14,6 @@ public class User { ...@@ -14,85 +14,6 @@ public class User {
String phone_number; String phone_number;
String qq_mail; String qq_mail;
public static void user_to_array(ArrayList<User> user_array){
user_array.clear();
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
System.out.println("Creating statement user...");
stmt = conn.createStatement();
String sql = "SELECT * FROM user ";
ResultSet rs = stmt.executeQuery(sql);
conn.setAutoCommit(false);
while (rs.next()) {
// int id, int borrowing_books, String user_uuid,String student_id,String user_password, String phone_number,String qq_mail
int borrowing_books = rs.getInt("borrowing_books");
String user_id = rs.getString("user_id");
String student_id = rs.getString("student_id");
String user_password = rs.getString("user_password");
String phone_number = rs.getString("phone_number");
String username = rs.getString("username");
String qq_mail = rs.getString("qq_mail");
User.user_to_arr(borrowing_books,user_id,username,student_id,user_password,phone_number,qq_mail,user_array);
}
conn.commit();
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
public static void user_to_arr(int borrowing_books, String user_id,String username,
String student_id,String user_password,
String phone_number,String qq_mail,ArrayList<User> user_array){
User user = new User();
user.borrowing_books= borrowing_books;
user.user_id = user_id;
user.username = username;
user.student_id= student_id;
user.user_password = user_password;
user.phone_number = phone_number;
user.qq_mail = qq_mail;
user_array.add(user);
}
public int getBorrowing_books() { public int getBorrowing_books() {
......
...@@ -18,6 +18,8 @@ public class OriginFitlerTwice implements javax.servlet.Filter{ ...@@ -18,6 +18,8 @@ public class OriginFitlerTwice implements javax.servlet.Filter{
@Override @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
System.out.println("88888ppppppp");
HttpServletResponse response = (HttpServletResponse) res; HttpServletResponse response = (HttpServletResponse) res;
response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "*"); response.setHeader("Access-Control-Allow-Methods", "*");
......
package com.Service.Manage;
import com.Dao.Books;
import com.Service.Tool.GenerateUuid;
import com.pojo.BooksSql;
public class AddBook {
public static void add_book(String jdid, String bookshelf_id,
String book_name, String category, String author,
String publisher, String image){
Books book = new Books();
book.setJdid(Integer.parseInt(jdid));
book.setBookshelf_id(Integer.parseInt(bookshelf_id));
book.setBook_name(book_name);
book.setCategory(category);
book.setAuthor(author);
book.setPublisher(publisher);
book.setImage(image);
book.setBorrow_times(0);
book.setBook_same_id(42);
book.setId(GenerateUuid.create_uuid());
BooksSql.add_book(book);
}
}
package com.Service.Manage;
import com.pojo.BooksSql;
public class DeleteBook {
public static void delete_book(String book_id){
BooksSql.delete_book(book_id);
}
}
package com.Service.Manage;
import com.Dao.Books;
import com.pojo.BooksSql;
public class FixBook {
public static void fix_book(String book_id,String jdid, String bookshelf_id,
String book_name, String category, String author,
String publisher, String image){
Books book = new Books();
book.setId(book_id);
book.setJdid(Integer.parseInt(jdid));
book.setBookshelf_id(Integer.parseInt(bookshelf_id));
book.setBook_name(book_name);
book.setCategory(category);
book.setAuthor(author);
book.setPublisher(publisher);
book.setImage(image);
BooksSql.fix_book(book);
}
}
package com.Service.Manage;
import com.Dao.Books;
import com.Dao.User;
import com.pojo.BooksSql;
import com.pojo.BorrowSql;
import com.pojo.UserSql;
import java.util.ArrayList;
public class IsReturn {
public static void IsReturn(String borrow_id,int is_return){
BorrowSql.change_is_return(borrow_id,is_return);
}
public static void IsReturn(String book_id,String user_id,int is_return){
ArrayList<Books> book_array = new ArrayList<>();
BooksSql.books_to_array(book_array);
ArrayList<User> user_array = new ArrayList<>();
UserSql.user_to_array(user_array);
for (Books temp:book_array
) {
if (temp.getId().equals(book_id)){
for (User temp2:user_array
) {
if (temp2.getUser_id().equals(user_id)) {
BorrowSql.add_borrow(temp,temp2,is_return);
}
}
}
}
}
}
package com.Service.Manage;
import com.Dao.Books;
import com.Dao.Borrow;
import com.Dao.Return_before;
import com.Dao.User;
import com.pojo.BooksSql;
import com.pojo.BorrowSql;
import com.pojo.UserSql;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
public class PrintBorrowed {
/**
* 打印申请记录
* @param print_borrowed
*/
public static void print_require(ArrayList<Return_before> print_borrowed,int choose) {
ArrayList<Borrow> borrow_array = new ArrayList();
BorrowSql.borrow_to_array(borrow_array);
// System.out.println(borrow_array.size());
ArrayList<Books> book_array = new ArrayList<>();
BooksSql.book_top_array(book_array);
ArrayList<User> user_array = new ArrayList<>();
UserSql.user_to_array(user_array);
for (Borrow temp : borrow_array
) {
// System.out.println(temp.getBook_name());
//
// System.out.println(borrow_array.size());
System.out.println(temp.getIs_return());
if (temp.getIs_return() == choose) {
// System.out.println(":4444");
Return_before a = new Return_before();
a.setUser_id(temp.getUser_id());
a.setBorrow_id(temp.getBorrow_id());
a.setManage_id(temp.getManage_id());
a.setBook_id(temp.getBook_id());
a.setBook_name(temp.getBook_name());
a.setBorrow_time(temp.getBorrow_time());
for (Books temp2 : book_array
) {
if (temp2.getId().equals(temp.getBook_id())) {
a.setJdid(temp2.getJdid());
a.setBookshelf_id(temp2.getBookshelf_id());
a.setBook_same_id(temp2.getBook_same_id());
print_borrowed.add(a);
for (User temp3: user_array
) {
if(temp3.getUser_id().equals(temp.getUser_id()))
a.setUser_name(temp3.getUsername());
a.setReturn_time(String.valueOf(new Date()));
// System.out.println(a.getReturn_time());
}
}
}
}
// System.out.println("555");
}
}
/**
* 打印历史借阅记录
* @param print_borrowed
*/
public static void print_borrowed(ArrayList<Return_before> print_borrowed){
ArrayList<Borrow> borrow_array = new ArrayList();
BorrowSql.borrow_to_array(borrow_array);
for (Borrow temp:borrow_array
) {
if (temp.getIs_return() == 1) {
ArrayList<Books> book_array = new ArrayList<>();
BooksSql.book_top_array(book_array);
Return_before a = new Return_before();
a.setUser_id(temp.getUser_id());
a.setBorrow_id(temp.getBorrow_id());
a.setManage_id(temp.getManage_id());
a.setBook_id(temp.getBook_id());
a.setBook_name(temp.getBook_name());
a.setBorrow_time(temp.getBorrow_time());
for (Books temp2 : book_array
) {
ArrayList<User> user_array = new ArrayList<>();
UserSql.user_to_array(user_array);
if (temp2.getId().equals(temp.getBook_id())) {
a.setJdid(temp2.getJdid());
a.setBookshelf_id(temp2.getBookshelf_id());
a.setBook_same_id(temp2.getBook_same_id());
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
a.setReturn_time(df.format(new Date()));
for (User temp3 : user_array
) {
if (temp3.getUser_id().equals(temp.getUser_id()))
a.setUser_name(temp3.getUsername());
print_borrowed.add(a);
}
}
}
}
}
}
}
package com.Service;
import com.Dao.Books;
import com.Dao.Borrow;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import static com.Service.Timeout_prompt.getTime;
public class Time_out {
public static void time_out(String user_id, ArrayList<Borrow> timeout) {
ArrayList<Borrow> borrows_array = new ArrayList<>();
Borrow.borrow_to_array(borrows_array);
for (Borrow temp : borrows_array
) {
if (temp.getUser_id().equals(user_id)) {
String[] str = temp.getBorrow_time().split("-");
Date time1 = getTime(str, 7);
System.out.println("指定时间time=" + time1);
int compareTo = time1.compareTo(new Date());
System.out.println("5464896556");
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
if (compareTo < 0) {
timeout.add(temp);
}
}
}
}
}
package com.Service; package com.Service;
import com.Service.User.TimeOut.TimeOutPrompt;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Timer; import java.util.Timer;
...@@ -35,7 +37,7 @@ public class Timing extends Timer { ...@@ -35,7 +37,7 @@ public class Timing extends Timer {
@Override @Override
public void run() { public void run() {
Timeout_prompt.Time_check();//执行代码 TimeOutPrompt.Time_check();//执行代码
} }
},date,PERIOD_DAY); },date,PERIOD_DAY);
......
package com.Service; package com.Service.Tool;
import java.util.UUID; import java.util.UUID;
public class Generate_uuid { public class GenerateUuid {
/** /**
* *
......
package com.Service; package com.Service.Tool;
import java.util.Properties; import java.util.Properties;
...@@ -17,7 +17,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl; ...@@ -17,7 +17,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
/** /**
* 使用QQ发送邮件工具类 * 使用QQ发送邮件工具类
*/ */
public class QQ_mail { public class QQMail {
private final static String SERVICE_HOST = "smtp.qq.com";//QQ服务器 private final static String SERVICE_HOST = "smtp.qq.com";//QQ服务器
private final static int PORT = 465; //smtp的端口号 private final static int PORT = 465; //smtp的端口号
......
package com.Service.User.TimeOut;
import com.Dao.Books;
import com.pojo.BooksSql;
import java.util.ArrayList;
public class Judge {
public static void judge_kind(String choose, ArrayList<Books> require){
BooksSql.guide(choose,require);
}
}
package com.Service.User.TimeOut;
import com.Dao.Books;
import com.pojo.BooksSql;
import java.util.ArrayList;
public class PrintBook {
/**
* 返回一个榜单书籍的集合
* @param book_array
*/
public static void search_all(ArrayList<Books> book_array){
ArrayList<Books> books = new ArrayList<>();
BooksSql.book_top_array(books);
int index = 0;
for (Books books_temp:books
) {
book_array.add(books_temp);
}
}
}
package com.Service.User.TimeOut;
import com.Dao.Books;
import com.Dao.Borrow;
import com.Dao.Return_before;
import com.Dao.User;
import com.alibaba.fastjson.JSON;
import com.pojo.BooksSql;
import com.pojo.BorrowSql;
import com.pojo.UserSql;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import static com.Service.User.TimeOut.TimeOutPrompt.getTime;
public class TimeOut {
public static void time_out(String user_id, ArrayList<Return_before> return_t) {
ArrayList<Borrow> borrows_array = new ArrayList<>();
BorrowSql.borrow_to_array(borrows_array);
ArrayList<Books> book_array = new ArrayList<>();
BooksSql.book_top_array(book_array);
for (Borrow temp : borrows_array
) {
if (temp.getUser_id().equals(user_id)) {
String[] str = temp.getBorrow_time().split("-");
Date time1 = getTime(str, 7);
System.out.println("指定时间time=" + time1);
int compareTo = time1.compareTo(new Date());
System.out.println("5464896556");
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
// Date time5 = new Date();
if (compareTo > 0) {
Return_before a = new Return_before();
a.setUser_id(temp.getUser_id());
a.setBorrow_id(temp.getBorrow_id());
a.setManage_id(temp.getManage_id());
a.setBook_id(temp.getBook_id());
a.setBook_name(temp.getBook_name());
a.setBorrow_time(temp.getBorrow_time());
for (Books temp2 : book_array
) {
//
if (temp2.getId().equals(temp.getBook_id())) {
a.setJdid(temp2.getJdid());
a.setBookshelf_id(temp2.getBookshelf_id());
a.setBook_same_id(temp2.getBook_same_id());
return_t.add(a);
}
}
}
}
}
String json = JSON.toJSONString(return_t);
// PrintWriter out = response.getWriter();
System.out.println(json);
}
public static void all_time_out(ArrayList<Return_before> return_t) {
ArrayList<Borrow> borrows_array = new ArrayList<>();
BorrowSql.borrow_to_array(borrows_array);
ArrayList<Books> book_array = new ArrayList<>();
BooksSql.book_top_array(book_array);
for (Borrow temp : borrows_array
) {
if (temp.getIs_return() == 0) {
String[] str = temp.getBorrow_time().split("-");
Date time1 = getTime(str, 7);
System.out.println("指定时间time=" + time1);
int compareTo = time1.compareTo(new Date());
System.out.println("5464896556");
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
// Date time5 = new Date();
if (compareTo > 0) {
Return_before a = new Return_before();
a.setUser_id(temp.getUser_id());
a.setBorrow_id(temp.getBorrow_id());
a.setManage_id(temp.getManage_id());
a.setBook_id(temp.getBook_id());
a.setBook_name(temp.getBook_name());
a.setBorrow_time(temp.getBorrow_time());
for (Books temp2 : book_array
) {
if (temp2.getId().equals(temp.getBook_id())) {
a.setJdid(temp2.getJdid());
a.setBookshelf_id(temp2.getBookshelf_id());
a.setBook_same_id(temp2.getBook_same_id());
return_t.add(a);
ArrayList<User> user_array = new ArrayList<>();
UserSql.user_to_array(user_array);
for (User temp3: user_array
) {
if(temp3.getUser_id().equals(temp.getUser_id()))
a.setUser_name(temp3.getUsername());
a.setReturn_time(String.valueOf(new Date()));
// System.out.println(a.getReturn_time());
}
}
}
}
}
}
}
}
package com.Service; package com.Service.User.TimeOut;
import com.Dao.Borrow; import com.Dao.Borrow;
import com.pojo.BorrowSql;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
public class Timeout_prompt{ public class TimeOutPrompt {
static Timer timer; static Timer timer;
static String user_id; static String user_id;
...@@ -14,7 +15,7 @@ public class Timeout_prompt{ ...@@ -14,7 +15,7 @@ public class Timeout_prompt{
public static void Time_check(){ public static void Time_check(){
ArrayList<Borrow> borrow_array = new ArrayList<>(); ArrayList<Borrow> borrow_array = new ArrayList<>();
Borrow.borrow_to_array(borrow_array); BorrowSql.borrow_to_array(borrow_array);
for (Borrow borrow:borrow_array for (Borrow borrow:borrow_array
) { ) {
...@@ -26,26 +27,26 @@ public class Timeout_prompt{ ...@@ -26,26 +27,26 @@ public class Timeout_prompt{
Date time1 = getTime(str,7); Date time1 = getTime(str,7);
System.out.println("指定时间time=" + time1); // System.out.println("指定时间time=" + time1);
int compareTo = time1.compareTo(new Date()); int compareTo = time1.compareTo(new Date());
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
if(compareTo < 0){ if(compareTo < 0){
Timer_task_remind a = new Timer_task_remind(); TimerTaskRemind a = new TimerTaskRemind();
a.run(borrow.getUser_id(),borrow.getBorrow_time(),borrow.getBook_name()); a.run(borrow.getUser_id(),borrow.getBorrow_time(),borrow.getBook_name());
} }
Date time = getTime(str,5); Date time = getTime(str,5);
System.out.println("指定时间time=" + time); // System.out.println("指定时间time=" + time);
int compareTo2 = time1.compareTo(new Date()); int compareTo2 = time1.compareTo(new Date());
if(compareTo2 < 0){ if(compareTo2 < 0){
Timer_task_warn a = new Timer_task_warn(); TimerTaskWarn a = new TimerTaskWarn();
a.run(borrow.getUser_id(),borrow.getBorrow_time(),borrow.getBook_name()); a.run(borrow.getUser_id(),borrow.getBorrow_time(),borrow.getBook_name());
} }
System.out.println(df.format(new Date()));// new Date()为获取当前系统时间 // System.out.println(df.format(new Date()));// new Date()为获取当前系统时间
//
System.out.println(compareTo); // System.out.println(compareTo);
} }
} }
...@@ -74,23 +75,12 @@ public class Timeout_prompt{ ...@@ -74,23 +75,12 @@ public class Timeout_prompt{
calendar.set(Calendar.DAY_OF_MONTH,Integer.parseInt(str[2])+7); calendar.set(Calendar.DAY_OF_MONTH,Integer.parseInt(str[2])+7);
break; break;
} }
// calendar.set(Calendar.HOUR_OF_DAY,Integer.parseInt(str[3]));
// calendar.set(Calendar.MINUTE, Integer.parseInt(str[4]));
// calendar.set(Calendar.SECOND, str[5]);
Date time = calendar.getTime(); Date time = calendar.getTime();
return time; return time;
} }
// public static void main(String[] args) {
// Time_check();
// }
} }
package com.Service; package com.Service.User.TimeOut;
import com.Dao.User; import com.Dao.User;
import com.Service.Tool.QQMail;
import com.pojo.UserSql;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.TimerTask;
public class Timer_task_remind { public class TimerTaskRemind {
public void run(String user_uuid, String borrow_time, String book_name){ public void run(String user_uuid, String borrow_time, String book_name){
ArrayList<User> user_array = new ArrayList<>(); ArrayList<User> user_array = new ArrayList<>();
User.user_to_array(user_array); UserSql.user_to_array(user_array);
System.out.println("已超时!!\n"); // System.out.println("已超时!!\n");
for (User user:user_array for (User user:user_array
) { ) {
if(user.getUser_id().equals(user_uuid)){ if(user.getUser_id().equals(user_uuid)){
QQ_mail.send_qq_mail("705054686@qq.com",user.getUsername(),borrow_time, QQMail.send_qq_mail("705054686@qq.com",user.getUsername(),borrow_time,
book_name,"2022/2/25","18835963470"); book_name,"2022/2/25","18835963470");
} }
......
package com.Service; package com.Service.User.TimeOut;
import java.util.TimerTask; public class TimerTaskWarn {
public class Timer_task_warn {
......
package com.Service; package com.Service.User.TimeOut;
import com.Dao.Books; import com.Dao.Books;
import com.Dao.Borrow; import com.pojo.BooksSql;
import java.util.ArrayList; import java.util.ArrayList;
public class Top_print { public class TopPrint {
/** /**
...@@ -15,7 +15,7 @@ public class Top_print { ...@@ -15,7 +15,7 @@ public class Top_print {
public static void search_top(ArrayList<Books> book_top){ public static void search_top(ArrayList<Books> book_top){
ArrayList<Books> book_top_array = new ArrayList<>(); ArrayList<Books> book_top_array = new ArrayList<>();
Books.book_top_array(book_top_array); BooksSql.book_top_array(book_top_array);
int index = 0; int index = 0;
for (Books books_temp:book_top_array for (Books books_temp:book_top_array
......
package com.Service; package com.Service.User.TimeOut;
import com.Dao.Books; import com.Dao.Books;
import com.Dao.Borrow; import com.Dao.Borrow;
import com.Dao.Return_before; import com.Dao.Return_before;
import com.pojo.BooksSql;
import com.pojo.BorrowSql;
import java.util.ArrayList; import java.util.ArrayList;
public class Was_borrowed { public class WasBorrowed {
/** /**
* 返回一个用户的借阅记录集合 * 返回一个用户的借阅记录集合
...@@ -16,16 +18,13 @@ public class Was_borrowed { ...@@ -16,16 +18,13 @@ public class Was_borrowed {
*/ */
public static void was_borrowed(String user_id,ArrayList<Return_before> return_b ){ public static void was_borrowed(String user_id,ArrayList<Return_before> return_b ){
System.out.println();
return_b .clear(); return_b .clear();
ArrayList<Borrow> borrow_array = new ArrayList<>(); ArrayList<Borrow> borrow_array = new ArrayList<>();
Borrow.borrow_to_array(borrow_array); BorrowSql.borrow_to_array(borrow_array);
System.out.println("5555");
ArrayList<Books> book_array = new ArrayList<>(); ArrayList<Books> book_array = new ArrayList<>();
Books.book_top_array(book_array); BooksSql.book_top_array(book_array);
for (Borrow temp:borrow_array for (Borrow temp:borrow_array
...@@ -37,7 +36,6 @@ public class Was_borrowed { ...@@ -37,7 +36,6 @@ public class Was_borrowed {
Return_before a = new Return_before(); Return_before a = new Return_before();
a.setUser_id(temp.getUser_id()); a.setUser_id(temp.getUser_id());
System.out.println(temp.getUser_id());
a.setBorrow_id(temp.getBorrow_id()); a.setBorrow_id(temp.getBorrow_id());
a.setManage_id(temp.getManage_id()); a.setManage_id(temp.getManage_id());
a.setBook_id(temp.getBook_id()); a.setBook_id(temp.getBook_id());
...@@ -45,8 +43,6 @@ public class Was_borrowed { ...@@ -45,8 +43,6 @@ public class Was_borrowed {
a.setBorrow_time(temp.getBorrow_time()); a.setBorrow_time(temp.getBorrow_time());
for (Books temp2:book_array for (Books temp2:book_array
) { ) {
System.out.println();
if (temp2.getId().equals(temp.getBook_id())){ if (temp2.getId().equals(temp.getBook_id())){
a.setJdid(temp2.getJdid()); a.setJdid(temp2.getJdid());
......
package com.Servlet.LoginServlet;
import com.Dao.Books;
import com.Service.User.TimeOut.TopPrint;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@Configuration
public class LoginServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder click_top_print = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
click_top_print.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(click_top_print);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String b = a.getString("login_stnum");
String c = a.getString("login_input_password");
System.out.println(b+" "+c);
String json = null;
PrintWriter out = response.getWriter();
String d = "404";
if (b.equals("1") && c.equals("2")) {
ArrayList<Books> book_top = new ArrayList<>();
TopPrint.search_top(book_top);
JSONArray book_top_json = null;
json = JSON.toJSONString(book_top);
}
out.print(json);
}
}
package com.Servlet.ManageServlet;
import com.Dao.Return_before;
import com.Service.User.TimeOut.TimeOut;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@Configuration
public class AllTimeOutServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder user_id = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
user_id.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(user_id);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String click = a.getString("click");
System.out.println(user_id);
System.out.println();
String json = null;
if(click.equals("1")){
ArrayList<Return_before> return_t = new ArrayList<>();
TimeOut.all_time_out(return_t);
json = JSON.toJSONString(return_t);
PrintWriter out = response.getWriter();
json = JSON.toJSONString(return_t);
out.print(json);
}
}
}
package com.Servlet.ManageServlet.Book;
import com.Dao.Books;
import com.Service.Manage.AddBook;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
@Configuration
public class AddBookServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder click = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
click.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(click);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String jdid = a.getString("jdid");
String bookshelf_id = a.getString("bookshelf_id");
String book_name = a.getString("book_name");
String category = a.getString("category");
String author = a.getString("author");
String publisher = a.getString("publisher");
String image = a.getString("image");
AddBook.add_book(jdid,bookshelf_id,book_name,category,author,publisher,image);
String json = null;
String d = "200";
PrintWriter out = response.getWriter();
out.print(d);
}
}
\ No newline at end of file
package com.Servlet.ManageServlet.Book;
import com.Dao.Books;
import com.Service.Manage.AddBook;
import com.Service.Manage.DeleteBook;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
@Configuration
public class DeleteBookServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder click = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
click.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(click);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String book_id = a.getString("book_id");
DeleteBook.delete_book(book_id);
String json = null;
String d = "200";
PrintWriter out = response.getWriter();
out.print(d);
}
}
\ No newline at end of file
package com.Servlet.ManageServlet.Book;
import com.Dao.Books;
import com.Service.Manage.AddBook;
import com.Service.Manage.FixBook;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
@Configuration
public class FixBookServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder click = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
click.append((char) respInt);
respInt = inputStreamReader.read();
}
System.out.println("ssssssssss");
String jsonString = String.valueOf(click);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String book_id = a.getString("book_id");
String jdid = a.getString("jdid");
String bookshelf_id = a.getString("bookshelf_id");
String book_name = a.getString("book_name");
String category = a.getString("category");
String author = a.getString("author");
String publisher = a.getString("publisher");
String image = a.getString("image");
// System.out.println("ssssssssss2");
FixBook.fix_book(book_id,jdid,bookshelf_id,book_name,category,author,publisher,image);
// System.out.println("ssssssssss3");
String json = null;
String d = "200";
PrintWriter out = response.getWriter();
out.print(d);
}
}
\ No newline at end of file
package com.Servlet.ManageServlet.Choose;
import com.Service.Manage.IsReturn;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
@Configuration
public class AgreeBorrowServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("qqqqqqqq");
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder click = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
click.append((char) respInt);
respInt = inputStreamReader.read();
}
System.out.println("555[[[");
String jsonString = String.valueOf(click);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String borrow_id = a.getString("borrow_id");
String json = null;
IsReturn.IsReturn(borrow_id,0);
String d = "200";
PrintWriter out = response.getWriter();
out.print(d);
}
}
\ No newline at end of file
package com.Servlet.ManageServlet.Choose;
import com.Service.Manage.IsReturn;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
@Configuration
public class AgreeReturnServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder click = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
click.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(click);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String borrow_id = a.getString("borrow_id");
String json = null;
IsReturn.IsReturn(borrow_id, 1);
String d = "200";
PrintWriter out = response.getWriter();
out.print(d);
}
}
\ No newline at end of file
package com.Servlet.ManageServlet.Choose;
import com.Service.Manage.IsReturn;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
@Configuration
public class RefuseBorrowServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder click = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
click.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(click);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String borrow_id = a.getString("borrow_id");
String json = null;
String d = "200";
IsReturn.IsReturn(borrow_id,4);
PrintWriter out = response.getWriter();
out.print(d);
}
}
\ No newline at end of file
package com.Servlet.ManageServlet.Choose;
import com.Service.Manage.IsReturn;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
@Configuration
public class RefuseReturnServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder click = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
click.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(click);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String borrow_id = a.getString("borrow_id");
String json = null;
IsReturn.IsReturn(borrow_id,0);
String d = "200";
PrintWriter out = response.getWriter();
out.print(d);
}
}
\ No newline at end of file
package com.Servlet.ManageServlet;
import com.Dao.Return_before;
import com.Service.Manage.PrintBorrowed;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@Configuration
public class PrintApplyServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder user_id = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
user_id.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(user_id);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String click = a.getString("click");
String json = null;
ArrayList<Return_before> return_t = new ArrayList<>();
if(click.equals("1")) {
PrintBorrowed.print_require(return_t,3);
json = JSON.toJSONString(return_t);
}
PrintWriter out = response.getWriter();
json = JSON.toJSONString(return_t);
out.print(json);
}
}
package com.Servlet.ManageServlet;
import com.Dao.Books;
import com.Service.Timing;
import com.Service.User.TimeOut.TopPrint;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.pojo.BooksSql;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@Configuration
public class PrintBookServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Timing c = new Timing();
c.start();
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder click_top_print = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
click_top_print.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(click_top_print);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String b = a.getString("click");
String json = null;
if (b.equals("1")) {
ArrayList<Books> book_array = new ArrayList<>();
BooksSql.books_to_array(book_array);
JSONArray book_top_json = null;
json = JSON.toJSONString(book_array);
}
PrintWriter out = response.getWriter();
out.print(json);
}
}
package com.Servlet.ManageServlet;
import com.Dao.Return_before;
import com.Service.Manage.PrintBorrowed;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@Configuration
public class PrintBorrowedServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder user_id = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
user_id.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(user_id);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String click = a.getString("click");
String json = null;
ArrayList<Return_before> return_t = new ArrayList<>();
if(click.equals("1")) {
PrintBorrowed.print_borrowed(return_t);
json = JSON.toJSONString(return_t);
}
PrintWriter out = response.getWriter();
json = JSON.toJSONString(return_t);
out.print(json);
}
}
package com.Servlet.ManageServlet;
import com.Dao.Return_before;
import com.Service.Manage.PrintBorrowed;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@Configuration
public class PrintReturnServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder user_id = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
user_id.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(user_id);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String click = a.getString("click");
String json = null;
ArrayList<Return_before> return_t = new ArrayList<>();
if(click.equals("1")) {
PrintBorrowed.print_require(return_t,2);
json = JSON.toJSONString(return_t);
}
PrintWriter out = response.getWriter();
json = JSON.toJSONString(return_t);
out.print(json);
}
}
package com.Servlet.UserServlet;
import com.Service.Manage.IsReturn;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
@Configuration
public class BorrowServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder inf = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
inf.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(inf);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String book_id = a.getString("book_id");
String user_id = a.getString("user_id");
String json = null;
IsReturn.IsReturn(book_id,user_id,3);
PrintWriter out = response.getWriter();
String d = "200";
json = JSON.toJSONString(d);
out.print(json);
}
}
\ No newline at end of file
package com.Servlet; package com.Servlet.UserServlet;
import com.Dao.Books; import com.Dao.Books;
import com.Dao.Borrow;
import com.Service.Time_out;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.pojo.BooksSql;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import javax.servlet.ServletException; import javax.servlet.ServletException;
...@@ -19,11 +18,12 @@ import java.util.ArrayList; ...@@ -19,11 +18,12 @@ import java.util.ArrayList;
@Configuration @Configuration
public class Time_outServlet extends HttpServlet { public class GuideSearchServlet extends HttpServlet {
@Override @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8"); response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
...@@ -33,27 +33,29 @@ public class Time_outServlet extends HttpServlet { ...@@ -33,27 +33,29 @@ public class Time_outServlet extends HttpServlet {
int respInt = inputStreamReader.read(); int respInt = inputStreamReader.read();
while (respInt != -1) { while (respInt != -1) {
user_id.append((char) respInt); user_id.append((char) respInt);
respInt = inputStreamReader.read(); respInt = inputStreamReader.read();
} }
String jsonString = String.valueOf(user_id);// 将 char 数组 data 转换成字符串 String jsonString = String.valueOf(user_id);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString); JSONObject a = JSON.parseObject(jsonString);
String userid = a.getString("user_id"); String choose = a.getString("choose");
System.out.println(user_id); System.out.println(user_id);
System.out.println();
String json = null; String json = null;
ArrayList<Borrow> time_out = new ArrayList<>();
Time_out.time_out(userid,time_out);
json = JSON.toJSONString(time_out); ArrayList<Books> require = new ArrayList<>();
BooksSql.guide(choose,require);
json = JSON.toJSONString(require);
PrintWriter out = response.getWriter(); PrintWriter out = response.getWriter();
json = JSON.toJSONString(time_out); json = JSON.toJSONString(require);
out.print(json); out.print(json);
} }
......
package com.Servlet.UserServlet;
import com.Dao.Books;
import com.Dao.Return_before;
import com.Service.User.TimeOut.PrintBook;
import com.Service.User.TimeOut.TimeOut;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@Configuration
public class PrintBookServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder user_id = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
user_id.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(user_id);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String click = a.getString("click");
System.out.println(user_id);
System.out.println();
String json = null;
ArrayList<Books> book_array = new ArrayList<>();
if (click.equals("1")) {
PrintBook.search_all(book_array);
json = JSON.toJSONString(book_array);
}
PrintWriter out = response.getWriter();
json = JSON.toJSONString(book_array);
out.print(json);
}
}
package com.Servlet.UserServlet;
import com.Service.Manage.IsReturn;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
@Configuration
public class ReturnServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder inf = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
inf.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(inf);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String borrow_id = a.getString("borrow_id");
String json = null;
IsReturn.IsReturn(borrow_id,2);
PrintWriter out = response.getWriter();
String d = "200";
json = JSON.toJSONString(d);
out.print(json);
}
}
\ No newline at end of file
package com.Servlet.UserServlet;
import com.Dao.Books;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.pojo.BooksSql;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@Configuration
public class SearchNameServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder user_id = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
user_id.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(user_id);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String book_name = a.getString("book_name");
String json = null;
ArrayList<Books> require = new ArrayList<>();
BooksSql.search_name(book_name,require);
PrintWriter out = response.getWriter();
json = JSON.toJSONString(require);
out.print(json);
}
}
package com.Servlet.UserServlet;
import com.Dao.Return_before;
import com.Service.User.TimeOut.TimeOut;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@Configuration
public class TimeOutServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder user_id = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
user_id.append((char) respInt);
respInt = inputStreamReader.read();
}
String jsonString = String.valueOf(user_id);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String userid = a.getString("user_id");
System.out.println(user_id);
// System.out.println();
String json = null;
ArrayList<Return_before> return_t = new ArrayList<>();
TimeOut.time_out(userid,return_t);
json = JSON.toJSONString(return_t);
PrintWriter out = response.getWriter();
json = JSON.toJSONString(return_t);
out.print(json);
}
}
package com.Servlet; package com.Servlet.UserServlet;
import com.Dao.Books; import com.Dao.Books;
import com.Service.Timing; import com.Service.Timing;
import com.Service.Top_print; import com.Service.User.TimeOut.TopPrint;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -20,11 +20,12 @@ import java.util.ArrayList; ...@@ -20,11 +20,12 @@ import java.util.ArrayList;
@Configuration @Configuration
public class Top_printServlet extends HttpServlet { public class TopPrintServlet extends HttpServlet {
@Override @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("777qqqq");
Timing c = new Timing(); Timing c = new Timing();
c.start(); c.start();
...@@ -51,7 +52,7 @@ public class Top_printServlet extends HttpServlet { ...@@ -51,7 +52,7 @@ public class Top_printServlet extends HttpServlet {
if (b.equals("1")) { if (b.equals("1")) {
ArrayList<Books> book_top = new ArrayList<>(); ArrayList<Books> book_top = new ArrayList<>();
Top_print.search_top(book_top); TopPrint.search_top(book_top);
JSONArray book_top_json = null; JSONArray book_top_json = null;
json = JSON.toJSONString(book_top); json = JSON.toJSONString(book_top);
......
package com.Servlet; package com.Servlet.UserServlet;
import com.Dao.Return_before; import com.Dao.Return_before;
import com.Service.Top_print; import com.Service.User.TimeOut.WasBorrowed;
import com.Service.Was_borrowed;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
...@@ -17,7 +15,7 @@ import java.nio.charset.StandardCharsets; ...@@ -17,7 +15,7 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
public class Was_borrowedServlet extends HttpServlet { public class WasBorrowedServlet extends HttpServlet {
@Override @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
...@@ -25,6 +23,7 @@ public class Was_borrowedServlet extends HttpServlet { ...@@ -25,6 +23,7 @@ public class Was_borrowedServlet extends HttpServlet {
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
System.out.println("77777777");
//fastjson //fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8); InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder user_id = new StringBuilder(); StringBuilder user_id = new StringBuilder();
...@@ -42,7 +41,7 @@ public class Was_borrowedServlet extends HttpServlet { ...@@ -42,7 +41,7 @@ public class Was_borrowedServlet extends HttpServlet {
String json = null; String json = null;
ArrayList<Return_before> return_b = new ArrayList<>(); ArrayList<Return_before> return_b = new ArrayList<>();
Was_borrowed.was_borrowed(b,return_b); WasBorrowed.was_borrowed(b,return_b);
json = JSON.toJSONString(return_b); json = JSON.toJSONString(return_b);
......
package com.example.javaproject2;
import java.sql.*;
import java.util.ArrayList;
import java.sql.*;
public class Data {
private String id;
private String food_name;
private int price;
private String jpg_adr;
private int value;
// public static void add_array(String id, String food_name, int price, String jpg_adr,int value, ArrayList<Data> array){
// Data a = new Data();
// a.setId(id);
// a.setFood_name(food_name);
// a.setPrice(price);
// a.setJpg_adr(jpg_adr);
// a.setValue(value);
// array.add(a);
// }
//
// public static void database(ArrayList<Data> array){
// add_array("001","寿司",13,"images/寿司.jpg",0,array);
// add_array("002","麻辣鱼",13,"images/麻辣鱼.jpg",1,array);
// add_array("003","重庆串串加面",18,"images/重庆串串加面.jpg",2,array);
// add_array("004","大闸蟹",27,"images/大闸蟹.gif",3,array);
// add_array("005","披萨",25,"images/ps2.jpg",4,array);
//
//
// }
public Data(String id, String food_name, int price, String jpg_adr,int value) {
this.id = id;
this.value = value;
this.food_name = food_name;
this.price = price;
this.jpg_adr = jpg_adr;
}
public Data() {
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFood_name() {
return food_name;
}
public void setFood_name(String food_name) {
this.food_name = food_name;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getJpg_adr() {
return jpg_adr;
}
public void setJpg_adr(String jpg_adr) {
this.jpg_adr = jpg_adr;
}
}
package com.example.javaproject2;
import java.io.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
@WebServlet(name = "helloServlet", value = "/hello-servlet")
public class HelloServlet extends HttpServlet {
private String message;
public void init() {
message = "Hello World!";
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("text/html");
// Hello
PrintWriter out = response.getWriter();
out.println("<html><body>");
out.println("<h1>" + message + "</h1>");
out.println("</body></html>");
}
public void destroy() {
}
}
\ No newline at end of file
package com.example.javaproject2;
import java.sql.*;
public class Login_compare {
// JDBC driver name and database URL
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
// static final String DB_URL = "jdbc:mysql://localhost:3306/school";
public static int compare(String username1, String password1) {
Connection conn = null;
Statement stmt = null;
try {
//STEP 2: Register JDBC driver
Class.forName("com.mysql.cj.jdbc.Driver");
//
// //STEP 3: Open a connection
System.out.println("Connecting to database...");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/restaurant?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8","root","sunwutong9");
// //STEP 4: Execute a query
System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql;
sql = "SELECT * FROM user where username = '"+username1+"'and password = '"+password1+"'";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while (rs.next()) {
return 2;
}
//STEP 6: Clean-up environment
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
return 1;
}//end main
}//end FirstExample - by www.yiibai.com//原文出自【易百教程】,商业转载请联系作者获得授权,非商业请保留原文链接:https://www.yiibai.com/jdbc/jdbc_quick_guide.html
package com.example.javaproject2;
public class User {
}
package com.pojo;
import com.Dao.Books;
import java.sql.*;
import java.util.ArrayList;
public class BooksSql {
/**
* 返回一个按数据库顺序排列的书籍集合
* @param books_array
*/
public static void search_name(String bookname,ArrayList<Books> books_array){
books_array.clear();
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Connecting to database top...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql="select * from books where book_name like '%"+bookname+"%'";
System.out.println(sql);
ResultSet rs = stmt.executeQuery(sql);
conn.setAutoCommit(false);
while (rs.next()) {
String id = rs.getString("id");
int jdid = rs.getInt("jdid");
int bookshelf_id= rs.getInt("bookshelf_id");
int borrow_times = rs.getInt("borrow_times");
String book_name = rs.getString("book_name");
String category = rs.getString("category");
String author = rs.getString("author");
String publisher = rs.getString("publisher");
String image = rs.getString("image");
int books_same_id = rs.getInt("book_same_id");
BooksSql.book_to_arr(id,jdid,bookshelf_id,book_name,books_same_id,category,author,publisher,image, borrow_times, books_array);
}
conn.commit();
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
/**
* 返回一个按数据库顺序排列的书籍集合
* @param books_array
*/
public static void guide(String choose,ArrayList<Books> books_array){
books_array.clear();
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Connecting to database top...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql = "SELECT * FROM books where category = '"+choose+"'";
ResultSet rs = stmt.executeQuery(sql);
conn.setAutoCommit(false);
while (rs.next()) {
String id = rs.getString("id");
int jdid = rs.getInt("jdid");
int bookshelf_id= rs.getInt("bookshelf_id");
int borrow_times = rs.getInt("borrow_times");
String book_name = rs.getString("book_name");
String category = rs.getString("category");
String author = rs.getString("author");
String publisher = rs.getString("publisher");
String image = rs.getString("image");
int books_same_id = rs.getInt("book_same_id");
BooksSql.book_to_arr(id,jdid,bookshelf_id,book_name,books_same_id,category,author,publisher,image, borrow_times, books_array);
}
conn.commit();
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
/**
*修改书籍
* @param book
*/
public static void fix_book(Books book){
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
System.out.println("Creating statement ...");
stmt = conn.createStatement();
String sql = "UPDATE books " +
"set jdid = "+book.getJdid()+
",bookshelf_id =" +book.getBookshelf_id()+
",book_name = '"+book.getBook_name()+
"',category ='"+book.getCategory()+
"',author = '"+book.getAuthor()+
"',publisher = '"+book.getPublisher()+
"',image = '"+book.getImage()+
"'where id = '"+book.getId()+"'";
stmt.executeUpdate(sql);
conn.setAutoCommit(false);
conn.commit();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
/**
*删除书籍
* @param book_id
*/
public static void delete_book(String book_id){
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
System.out.println("Creating statement ...");
stmt = conn.createStatement();
String sql = "DELETE FROM books WHERE id = '"+ book_id+"'";
System.out.println(sql);
stmt.executeUpdate(sql);
conn.setAutoCommit(false);
conn.commit();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
/**
*增加书籍
* @param book
*/
public static void add_book(Books book){
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
System.out.println("Creating statement ...");
stmt = conn.createStatement();
String sql = "INSERT INTO books (id,jdid,bookshelf_id,borrow_times," +
"book_same_id,book_name,category,author,publisher,image) VALUES ('"+book.getId()+"',"+
book.getJdid()+","+book.getBookshelf_id()+",'"+book.getBorrow_times()+"','"+
book.getBook_same_id()+"','"+book.getBook_name()+"','"+book.getCategory()+"','"+book.getAuthor()+"','"+
book.getPublisher()+"','"+book.getImage()+"' )";
stmt.executeUpdate(sql);
conn.setAutoCommit(false);
conn.commit();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
/**
* 返回一个按借阅次数排列的书籍集合
* @param books_array
*/
public static void book_top_array(ArrayList<Books> books_array){
books_array.clear();
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
System.out.println("Creating statement book...");
stmt = conn.createStatement();
String sql = "SELECT * FROM books order by borrow_times desc";
ResultSet rs = stmt.executeQuery(sql);
conn.setAutoCommit(false);
while (rs.next()) {
String id = rs.getString("id");
int jdid = rs.getInt("jdid");
int bookshelf_id= rs.getInt("bookshelf_id");
int borrow_times = rs.getInt("borrow_times");
String book_name = rs.getString("book_name");
String category = rs.getString("category");
String author = rs.getString("author");
String publisher = rs.getString("publisher");
String image = rs.getString("image");
int books_same_id = rs.getInt("book_same_id");
BooksSql.book_to_arr(id,jdid,bookshelf_id,book_name,books_same_id,category,author,publisher,image, borrow_times, books_array);
}
conn.commit();
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
/**
* 返回一个按数据库顺序排列的书籍集合
* @param books_array
*/
public static void books_to_array(ArrayList<Books> books_array){
books_array.clear();
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
System.out.println("Connecting to database top...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql = "SELECT * FROM books ";
ResultSet rs = stmt.executeQuery(sql);
conn.setAutoCommit(false);
while (rs.next()) {
String id = rs.getString("id");
int jdid = rs.getInt("jdid");
int bookshelf_id= rs.getInt("bookshelf_id");
int borrow_times = rs.getInt("borrow_times");
String book_name = rs.getString("book_name");
String category = rs.getString("category");
String author = rs.getString("author");
String publisher = rs.getString("publisher");
String image = rs.getString("image");
int books_same_id = rs.getInt("book_same_id");
BooksSql.book_to_arr(id,jdid,bookshelf_id,book_name,books_same_id,category,author,publisher,image, borrow_times, books_array);
}
conn.commit();
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
public static void book_to_arr(String id, int jdid, int bookshelf_id,
String book_name, int book_same_id,
String category, String author,
String publisher, String image,
int borrow_times, ArrayList<Books> books_array){
Books books = new Books();
books.setId(id);
books.setAuthor(author);
books.setJdid(jdid);
books.setBookshelf_id(bookshelf_id);
books.setBook_name(book_name);
books.setBook_same_id(book_same_id);
books.setCategory(category);
books.setPublisher(publisher);
books.setImage(image);
books.setBorrow_times(borrow_times);
books_array.add(books);
}
}
package com.pojo;
import com.Dao.Books;
import com.Dao.Borrow;
import com.Dao.User;
import com.Service.Tool.GenerateUuid;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
public class BorrowSql {
/**
* 增加借书记录
* @param book
* @param user
* @param is_return
*/
public static void add_borrow(Books book, User user, int is_return){
Connection conn = null;
// System.out.println("44444");
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
// System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String date = simpleDateFormat.format(new java.util.Date());
String manage_id = "5555";
// System.out.println("Creating statement ...");
stmt = conn.createStatement();
String sql = "INSERT INTO borrow (user_id,borrow_id,manage_id,book_id," +
"username,book_name,borrow_time,is_return,already_remind) VALUES ('"+user.getUser_id()+"','"+
GenerateUuid.create_uuid() +"','"+manage_id+"','"+book.getId()+"','"+
user.getUsername()+"','"+book.getBook_name()+"','"+ "null"+"',"+3+","
+0+" )";
stmt.executeUpdate(sql);
conn.setAutoCommit(false);
conn.commit();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
/**
* 改变状态
* @param borrow_id
*/
public static void change_is_return(String borrow_id,int is_return){
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
// System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
// System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql = "UPDATE borrow " +
" set is_return = "+is_return
+" where borrow_id = '"+borrow_id+"'";
// System.out.println(sql);
stmt.executeUpdate(sql);
conn.setAutoCommit(false);
conn.commit();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try id,user_uuid,borrow_uuid,manage_uuid,book_uuid,username,book_name,borrow_time,is_return
}
/**
* 同意借书
* @param borrow_id
*/
public static void agree_borrow(String borrow_id){
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
// System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
// System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql = "UPDATE borrow " +
" set is_return = "+0
+" where borrow_id = '"+borrow_id+"'";
System.out.println(sql);
stmt.executeUpdate(sql);
conn.setAutoCommit(false);
conn.commit();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try id,user_uuid,borrow_uuid,manage_uuid,book_uuid,username,book_name,borrow_time,is_return
}
/**
* 将所有历史借书记录转为集合
* @param borrow_array
*/
public static void borrow_to_array(ArrayList<Borrow> borrow_array){
borrow_array.clear();
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
// System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
// System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql = "SELECT * FROM borrow";
ResultSet rs = stmt.executeQuery(sql);
conn.setAutoCommit(false);
while (rs.next()) {
String user_id = rs.getString("user_id");
String borrow_id = rs.getString("borrow_id");
String manage_id = rs.getString("manage_id");
String book_id = rs.getString("book_id");
String username = rs.getString("username");
String book_name = rs.getString("book_name");
String borrow_time = rs.getString("borrow_time");
int is_return = rs.getInt("is_return");
int already_remind = rs.getInt("already_remind");
BorrowSql.borrow_to_arr(user_id,borrow_id,manage_id,book_id,username,book_name,borrow_time,is_return,already_remind,borrow_array);
}
conn.commit();
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try id,user_uuid,borrow_uuid,manage_uuid,book_uuid,username,book_name,borrow_time,is_return
}
/**
* 将东西放到对象里
* @param user_id
* @param borrow_id
* @param manage_id
* @param book_id
* @param username
* @param book_name
* @param borrow_time
* @param is_return
* @param already_remind
* @param borrow_array
*/
public static void borrow_to_arr(String user_id, String borrow_id,
String manage_id, String book_id,
String username,String book_name,String borrow_time,
int is_return,int already_remind,ArrayList<Borrow> borrow_array){
Borrow borrow = new Borrow();
borrow.setBorrow_id(borrow_id);
borrow.setUsername(username);
borrow.setUser_id(user_id);
borrow.setBook_name(book_name);
borrow.setBook_id(book_id);
borrow.setManage_id(manage_id);
borrow.setBorrow_time(borrow_time);
borrow.setIs_return(is_return);
borrow.setAlready_remind(already_remind);
borrow_array.add(borrow);
}
}
package com.pojo;
import com.Dao.User;
import java.sql.*;
import java.util.ArrayList;
public class UserSql {
public static void user_to_array(ArrayList<User> user_array){
user_array.clear();
Connection conn = null;
Statement stmt = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
// System.out.println("Connecting to database...");
String url = "jdbc:mysql://localhost:3306/book_system?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8";
String root = "root";
String password = "sunwutong9";
conn = DriverManager.getConnection(url,root,password);
// System.out.println("Creating statement user...");
stmt = conn.createStatement();
String sql = "SELECT * FROM user ";
ResultSet rs = stmt.executeQuery(sql);
conn.setAutoCommit(false);
while (rs.next()) {
// int id, int borrowing_books, String user_uuid,String student_id,String user_password, String phone_number,String qq_mail
int borrowing_books = rs.getInt("borrowing_books");
String user_id = rs.getString("user_id");
String student_id = rs.getString("student_id");
String user_password = rs.getString("user_password");
String phone_number = rs.getString("phone_number");
String username = rs.getString("username");
String qq_mail = rs.getString("qq_mail");
UserSql.user_to_arr(borrowing_books,user_id,username,student_id,user_password,phone_number,qq_mail,user_array);
}
conn.commit();
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
}
public static void user_to_arr(int borrowing_books, String user_id,String username,
String student_id,String user_password,
String phone_number,String qq_mail,ArrayList<User> user_array){
User user = new User();
user.setBorrowing_books(borrowing_books);
user.setUser_id(user_id);
user.setUsername(username);
user.setStudent_id(student_id);
user.setUser_password(user_password);
user.setPhone_number(phone_number);
user.setQq_mail(qq_mail);
user_array.add(user);
}
}
...@@ -5,46 +5,198 @@ ...@@ -5,46 +5,198 @@
version="4.0"> version="4.0">
<servlet> <servlet>
<servlet-name>LoginServlet</servlet-name> <servlet-name>RefuseBorrowServlet</servlet-name>
<servlet-class>LoginServlet</servlet-class> <servlet-class>com.Servlet.ManageServlet.Choose.RefuseBorrowServlet</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>LoginServlet</servlet-name> <servlet-name>RefuseBorrowServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern> <url-pattern>/RefuseBorrowServlet</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet> <servlet>
<servlet-name>Top_printServlet</servlet-name> <servlet-name>AgreeBorrowServlet</servlet-name>
<servlet-class>com.Servlet.Top_printServlet</servlet-class> <servlet-class>com.Servlet.ManageServlet.Choose.AgreeBorrowServlet</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>Top_printServlet</servlet-name> <servlet-name>AgreeBorrowServlet</servlet-name>
<url-pattern>/Top_printServlet</url-pattern> <url-pattern>/AgreeBorrowServlet</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet> <servlet>
<servlet-name>Was_borrowedServlet</servlet-name> <servlet-name>RefuseReturnServlet</servlet-name>
<servlet-class>com.Servlet.Was_borrowedServlet</servlet-class> <servlet-class>com.Servlet.ManageServlet.Choose.RefuseReturnServlet</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>Was_borrowedServlet</servlet-name> <servlet-name>RefuseReturnServlet</servlet-name>
<url-pattern>/Was_borrowedServlet</url-pattern> <url-pattern>/RefuseReturnServlet</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet>
<servlet-name>AgreeReturnServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.Choose.AgreeReturnServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AgreeReturnServlet</servlet-name>
<url-pattern>/AgreeReturnServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>TopPrintServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.TopPrintServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TopPrintServlet</servlet-name>
<url-pattern>/TopPrintServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>WasBorrowedServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.WasBorrowedServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WasBorrowedServlet</servlet-name>
<url-pattern>/WasBorrowedServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>TimeOutServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.TimeOutServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TimeOutServlet</servlet-name>
<url-pattern>/TimeOutServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>PrintBorrowedServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.PrintBorrowedServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PrintBorrowedServlet</servlet-name>
<url-pattern>/PrintBorrowedServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>AddBookServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.Book.AddBookServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AddBookServlet</servlet-name>
<url-pattern>/AddBookServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>DeleteBookServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.Book.DeleteBookServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DeleteBookServlet</servlet-name>
<url-pattern>/DeleteBookServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>FixBookServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.Book.FixBookServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FixBookServlet</servlet-name>
<url-pattern>/FixBookServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>GuideSearchServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.GuideSearchServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GuideSearchServlet</servlet-name>
<url-pattern>/GuideSearchServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>PrintBookServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.PrintBookServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PrintBookServlet</servlet-name>
<url-pattern>/PrintBookServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>SearchNameServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.SearchNameServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SearchNameServlet</servlet-name>
<url-pattern>/SearchNameServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>BorrowServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.BorrowServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>BorrowServlet</servlet-name>
<url-pattern>/BorrowServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ReturnServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.ReturnServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ReturnServlet</servlet-name>
<url-pattern>/ReturnServlet</url-pattern>
</servlet-mapping>
<servlet> <servlet>
<servlet-name>Time_outServlet</servlet-name> <servlet-name>PrintApplyServlet</servlet-name>
<servlet-class>com.Servlet.Time_outServlet</servlet-class> <servlet-class>com.Servlet.ManageServlet.PrintApplyServlet</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>Time_outServlet</servlet-name> <servlet-name>PrintApplyServlet</servlet-name>
<url-pattern>/Time_outServlet</url-pattern> <url-pattern>/PrintApplyServlet</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet>
<servlet-name>PrintReturnServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.PrintReturnServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PrintReturnServlet</servlet-name>
<url-pattern>/PrintReturnServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>AllTimeOutServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.AllTimeOutServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AllTimeOutServlet</servlet-name>
<url-pattern>/AllTimeOutServlet</url-pattern>
</servlet-mapping>
<filter> <filter>
......
...@@ -5,46 +5,198 @@ ...@@ -5,46 +5,198 @@
version="4.0"> version="4.0">
<servlet> <servlet>
<servlet-name>LoginServlet</servlet-name> <servlet-name>RefuseBorrowServlet</servlet-name>
<servlet-class>LoginServlet</servlet-class> <servlet-class>com.Servlet.ManageServlet.Choose.RefuseBorrowServlet</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>LoginServlet</servlet-name> <servlet-name>RefuseBorrowServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern> <url-pattern>/RefuseBorrowServlet</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet> <servlet>
<servlet-name>Top_printServlet</servlet-name> <servlet-name>AgreeBorrowServlet</servlet-name>
<servlet-class>com.Servlet.Top_printServlet</servlet-class> <servlet-class>com.Servlet.ManageServlet.Choose.AgreeBorrowServlet</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>Top_printServlet</servlet-name> <servlet-name>AgreeBorrowServlet</servlet-name>
<url-pattern>/Top_printServlet</url-pattern> <url-pattern>/AgreeBorrowServlet</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet> <servlet>
<servlet-name>Was_borrowedServlet</servlet-name> <servlet-name>RefuseReturnServlet</servlet-name>
<servlet-class>com.Servlet.Was_borrowedServlet</servlet-class> <servlet-class>com.Servlet.ManageServlet.Choose.RefuseReturnServlet</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>Was_borrowedServlet</servlet-name> <servlet-name>RefuseReturnServlet</servlet-name>
<url-pattern>/Was_borrowedServlet</url-pattern> <url-pattern>/RefuseReturnServlet</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet>
<servlet-name>AgreeReturnServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.Choose.AgreeReturnServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AgreeReturnServlet</servlet-name>
<url-pattern>/AgreeReturnServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>TopPrintServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.TopPrintServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TopPrintServlet</servlet-name>
<url-pattern>/TopPrintServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>WasBorrowedServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.WasBorrowedServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WasBorrowedServlet</servlet-name>
<url-pattern>/WasBorrowedServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>TimeOutServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.TimeOutServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TimeOutServlet</servlet-name>
<url-pattern>/TimeOutServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>PrintBorrowedServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.PrintBorrowedServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PrintBorrowedServlet</servlet-name>
<url-pattern>/PrintBorrowedServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>AddBookServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.Book.AddBookServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AddBookServlet</servlet-name>
<url-pattern>/AddBookServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>DeleteBookServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.Book.DeleteBookServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DeleteBookServlet</servlet-name>
<url-pattern>/DeleteBookServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>FixBookServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.Book.FixBookServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FixBookServlet</servlet-name>
<url-pattern>/FixBookServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>GuideSearchServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.GuideSearchServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GuideSearchServlet</servlet-name>
<url-pattern>/GuideSearchServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>PrintBookServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.PrintBookServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PrintBookServlet</servlet-name>
<url-pattern>/PrintBookServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>SearchNameServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.SearchNameServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SearchNameServlet</servlet-name>
<url-pattern>/SearchNameServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>BorrowServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.BorrowServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>BorrowServlet</servlet-name>
<url-pattern>/BorrowServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ReturnServlet</servlet-name>
<servlet-class>com.Servlet.UserServlet.ReturnServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ReturnServlet</servlet-name>
<url-pattern>/ReturnServlet</url-pattern>
</servlet-mapping>
<servlet> <servlet>
<servlet-name>Time_outServlet</servlet-name> <servlet-name>PrintApplyServlet</servlet-name>
<servlet-class>com.Servlet.Time_outServlet</servlet-class> <servlet-class>com.Servlet.ManageServlet.PrintApplyServlet</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>Time_outServlet</servlet-name> <servlet-name>PrintApplyServlet</servlet-name>
<url-pattern>/Time_outServlet</url-pattern> <url-pattern>/PrintApplyServlet</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet>
<servlet-name>PrintReturnServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.PrintReturnServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PrintReturnServlet</servlet-name>
<url-pattern>/PrintReturnServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>AllTimeOutServlet</servlet-name>
<servlet-class>com.Servlet.ManageServlet.AllTimeOutServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AllTimeOutServlet</servlet-name>
<url-pattern>/AllTimeOutServlet</url-pattern>
</servlet-mapping>
<filter> <filter>
......
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.example.javaproject2.Data" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.Iterator" %><%--
Created by IntelliJ IDEA.
User: lenovo
Date: 2022/1/27
Time: 22:41
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>
</title>
</head>
<body>
<%
Connection conn = null;
Statement stmt = null;
try {
//STEP 2: Register JDBC driver
Class.forName("com.mysql.cj.jdbc.Driver");
//
// //STEP 3: Open a connection
System.out.println("Connecting to database...");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/restaurant?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8","root","sunwutong9");
// //STEP 4: Execute a query
System.out.println("Creating statement...");
stmt = conn.createStatement();
System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql;
sql = "SELECT * FROM menu ";
ResultSet rs = stmt.executeQuery(sql);
%>
<h1 style="font-size:50px;color: red; " align = "center"><strong>登陆成功!云餐厅-欢迎您</strong></h1>
<h4 style="font-size:25px;color: black " align = "center"><strong>年夜饭,你想吃什么呢?</strong></h4>
<table width="900" border="2" class="table" align="center" rules="all" rules="all" >
<tr style="height:50px">
<%--表头--%>
<th style="font-size:30px;color: black;text-align: center" ><strong>编号</strong></th>
<th style="font-size:30px;color: black; text-align: center" ><strong>名称</strong></th>
<th style="font-size:30px;color: black; text-align: center; width:300px" ><strong>图片</strong></th>
<th style="font-size:30px;color: black; text-align: center" ><strong>价格</strong></th>
<th style="font-size:30px;color: black; text-align: center" ><strong>选择</strong></th>
</tr>
<form action="result.jsp" method="get" name="testForm" id="myForm">
<% while (rs.next()){
System.out.println("2222");
//Retrieve by column name
int id = rs.getInt("编号");
String name = rs.getString("菜名");
int price = rs.getInt("价格");
String address = rs.getString("图片地址");
int value = rs.getInt("值");
%>
<tr style="height:300px">
<td style="font-size:30px;color: black;text-align: center"><%=id%></td>
<td style="font-size:30px;color: black;text-align: center"><%=name%></td>
<td style="text-align: center"><img src="<%=address%>" alt="<%=name%>" title= "<%=name%>" width="200"></td>
<td style="font-size:30px;color: black;text-align: center"><%=price%></td>
<td style="text-align: center"><input type="checkbox" style="font-size: 35px" name="choose" id="category-001" value=<%=value%>></td>
</tr>
<% }
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}
//end try
%>
<tr style="height:70px">
<th colspan="5" style="text-align: center">
<button type="submit" style="font-size: 30px">结算</button></th>
</tr>
</form>
<script>
var obj = document.getElementsByName("interest");//选择所有name="interest"的对象,返回数组
var s='';//如果这样定义var s;变量s中会默认被赋个null值
for(var i=0;i<obj.length;i++){
if(obj[i].checked) //取到对象数组后,我们来循环检测它是不是被选中
s+=obj[i].value+','; //如果选中,将value添加到变量s中
}
</script>
<%
String[] s =request.getParameterValues("s");
request.getSession().getAttribute("s");
%>
</body>
</table>
</body>
</html>
\ No newline at end of file
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.example.javaproject2.Data" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.io.PrintWriter" %>
<%@ page import="java.sql.*" %>
<%--
Created by IntelliJ IDEA.
User: lenovo
Date: 2022/1/28
Time: 15:35
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<body>
<h2 style="text-align: center;color: black"><strong>你真会吃!</strong></h2>
<hr />
<%
String[] choose;
choose = request.getParameterValues("choose");
PrintWriter p = response.getWriter();
Connection conn = null;
Statement stmt = null;
try {
//STEP 2: Register JDBC driver
Class.forName("com.mysql.cj.jdbc.Driver");
//
// //STEP 3: Open a connection
System.out.println("Connecting to database...");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/restaurant?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8","root","sunwutong9");
// //STEP 4: Execute a query
System.out.println("Creating statement...");
stmt = conn.createStatement();
System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql;
sql = "SELECT * FROM menu ";
ResultSet rs = stmt.executeQuery(sql);
%>
<table width="900" border="2" class="table" align="center" rules="all" >
<tr style="height:50px">
<%--表头--%>
<th style="font-size:30px;color: black;text-align: center" ><strong>编号</strong></th>
<th style="font-size:30px;color: black; text-align: center" ><strong>名称</strong></th>
<th style="font-size:30px;color: black; text-align: center; width:300px" ><strong>图片</strong></th>
<th style="font-size:30px;color: black; text-align: center" ><strong>价格</strong></th>
</tr>
<%
int count = 0;
for(int i=0;i<choose.length;i++) {
int object =Integer.valueOf(choose[i]);
rs = stmt.executeQuery(sql);
while(rs.next()){
System.out.println("2222");
int value = rs.getInt("值");
if(object == value) {
//Retrieve by column name
int id = rs.getInt("编号");
String name = rs.getString("菜名");
int price = rs.getInt("价格");
String address = rs.getString("图片地址");
count += price;
%>
<tr style="height:300px">
<td style="font-size:30px;color: black;text-align: center"><%=id%></td>
<td style="font-size:30px;color: black;text-align: center"><%=name%></td>
<td style="text-align: center"><img src="<%=address%>" alt="<%=name%>" title= "<%=name%>" width="200"></td>
<td style="font-size:30px;color: black;text-align: center"><%=price%></td>
</tr>
<% }}}%>
</table>
<h2 style="text-align: center"><strong>总计:<%=count%></strong></h2>
<%
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null)
stmt.close();
} catch (SQLException se2) {
}// nothing we can do
try {
if (conn != null)
conn.close();
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}
%>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!-- APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443
This connector uses the NIO implementation. The default
SSLImplementation will depend on the presence of the APR/native
library and the useOpenSSL attribute of the AprLifecycleListener.
Either JSSE or OpenSSL style configuration may be used regardless of
the SSLImplementation selected. JSSE style configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
type="RSA" />
</SSLHostConfig>
</Connector>
-->
<!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
This connector uses the APR/native implementation which always uses
OpenSSL for TLS.
Either JSSE or OpenSSL style configuration may be used. OpenSSL style
configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
certificateFile="conf/localhost-rsa-cert.pem"
certificateChainFile="conf/localhost-rsa-chain.pem"
type="RSA" />
</SSLHostConfig>
</Connector>
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<!--
<Connector protocol="AJP/1.3"
address="::1"
port="8009"
redirectPort="8443" />
-->
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
</Host>
</Engine>
</Service>
</Server>
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: com.alibaba:fastjson:1.2.62"> <library name="Maven: aopalliance:aopalliance:1.0">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.62/fastjson-1.2.62.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/aopalliance/aopalliance/1.0/aopalliance-1.0.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.62/fastjson-1.2.62-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/aopalliance/aopalliance/1.0/aopalliance-1.0-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.62/fastjson-1.2.62-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>
\ No newline at end of file
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: com.sun.mail:javax.mail:1.6.2"> <library name="Maven: com.alibaba:fastjson:1.2.28">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/mail/javax.mail/1.6.2/javax.mail-1.6.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.28/fastjson-1.2.28.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/mail/javax.mail/1.6.2/javax.mail-1.6.2-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.28/fastjson-1.2.28-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/sun/mail/javax.mail/1.6.2/javax.mail-1.6.2-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.28/fastjson-1.2.28-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>
\ No newline at end of file
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot:2.2.6.RELEASE"> <library name="Maven: com.sun.mail:javax.mail:1.5.5">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot/2.2.6.RELEASE/spring-boot-2.2.6.RELEASE.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/sun/mail/javax.mail/1.5.5/javax.mail-1.5.5.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot/2.2.6.RELEASE/spring-boot-2.2.6.RELEASE-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/sun/mail/javax.mail/1.5.5/javax.mail-1.5.5-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot/2.2.6.RELEASE/spring-boot-2.2.6.RELEASE-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/sun/mail/javax.mail/1.5.5/javax.mail-1.5.5-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.springframework:spring-aop:5.2.5.RELEASE"> <library name="Maven: commons-beanutils:commons-beanutils:1.9.2">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/5.2.5.RELEASE/spring-aop-5.2.5.RELEASE.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/5.2.5.RELEASE/spring-aop-5.2.5.RELEASE-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/5.2.5.RELEASE/spring-aop-5.2.5.RELEASE-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>
\ No newline at end of file
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.springframework:spring-beans:5.2.9.RELEASE"> <library name="Maven: commons-collections:commons-collections:3.2.1">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/5.2.9.RELEASE/spring-beans-5.2.9.RELEASE.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/5.2.9.RELEASE/spring-beans-5.2.9.RELEASE-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/5.2.9.RELEASE/spring-beans-5.2.9.RELEASE-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>
\ No newline at end of file
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.springframework:spring-context:5.2.5.RELEASE"> <library name="Maven: commons-lang:commons-lang:2.6">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/5.2.5.RELEASE/spring-context-5.2.5.RELEASE.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/5.2.5.RELEASE/spring-context-5.2.5.RELEASE-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/5.2.5.RELEASE/spring-context-5.2.5.RELEASE-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>
\ No newline at end of file
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.springframework:spring-context-support:5.3.14"> <library name="Maven: commons-logging:commons-logging:1.1.1">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context-support/5.3.14/spring-context-support-5.3.14.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context-support/5.3.14/spring-context-support-5.3.14-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context-support/5.3.14/spring-context-support-5.3.14-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>
\ No newline at end of file
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.springframework:spring-core:5.3.14"> <library name="Maven: net.sf.composite:composite:1.1">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/5.3.14/spring-core-5.3.14.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/sf/composite/composite/1.1/composite-1.1.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/5.3.14/spring-core-5.3.14-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/sf/composite/composite/1.1/composite-1.1-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/5.3.14/spring-core-5.3.14-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/sf/composite/composite/1.1/composite-1.1-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>
\ No newline at end of file
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.springframework:spring-expression:5.2.5.RELEASE"> <library name="Maven: net.sf.ezmorph:ezmorph:1.0.6">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/5.2.5.RELEASE/spring-expression-5.2.5.RELEASE.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/5.2.5.RELEASE/spring-expression-5.2.5.RELEASE-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/5.2.5.RELEASE/spring-expression-5.2.5.RELEASE-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>
\ No newline at end of file
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.springframework:spring-jcl:5.3.14"> <library name="Maven: net.sf.json-lib:json-lib:jdk15:2.4">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-jcl/5.3.14/spring-jcl-5.3.14.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk15.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-jcl/5.3.14/spring-jcl-5.3.14-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/sf/json-lib/json-lib/2.4/json-lib-2.4-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-jcl/5.3.14/spring-jcl-5.3.14-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/sf/json-lib/json-lib/2.4/json-lib-2.4-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: net.sf.morph:morph:1.1.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/net/sf/morph/morph/1.1.1/morph-1.1.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/net/sf/morph/morph/1.1.1/morph-1.1.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/net/sf/morph/morph/1.1.1/morph-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-aop:4.0.7.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/4.0.7.RELEASE/spring-aop-4.0.7.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/4.0.7.RELEASE/spring-aop-4.0.7.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/4.0.7.RELEASE/spring-aop-4.0.7.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-beans:4.0.7.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/4.0.7.RELEASE/spring-beans-4.0.7.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/4.0.7.RELEASE/spring-beans-4.0.7.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/4.0.7.RELEASE/spring-beans-4.0.7.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-context:4.0.7.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/4.0.7.RELEASE/spring-context-4.0.7.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/4.0.7.RELEASE/spring-context-4.0.7.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/4.0.7.RELEASE/spring-context-4.0.7.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-context-support:4.0.7.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context-support/4.0.7.RELEASE/spring-context-support-4.0.7.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context-support/4.0.7.RELEASE/spring-context-support-4.0.7.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context-support/4.0.7.RELEASE/spring-context-support-4.0.7.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-core:4.0.7.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/4.0.7.RELEASE/spring-core-4.0.7.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/4.0.7.RELEASE/spring-core-4.0.7.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/4.0.7.RELEASE/spring-core-4.0.7.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-expression:4.0.7.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/4.0.7.RELEASE/spring-expression-4.0.7.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/4.0.7.RELEASE/spring-expression-4.0.7.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/4.0.7.RELEASE/spring-expression-4.0.7.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
...@@ -46,21 +46,29 @@ ...@@ -46,21 +46,29 @@
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.1" level="project" /> <orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.1" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" /> <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" /> <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.auth0:java-jwt:3.3.0" level="project" /> <orderEntry type="library" name="Maven: com.auth0:java-jwt:3.3.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.2" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.2" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" /> <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.62" level="project" /> <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.28" level="project" />
<orderEntry type="library" name="Maven: com.sun.mail:javax.mail:1.6.2" level="project" /> <orderEntry type="library" name="Maven: com.sun.mail:javax.mail:1.5.5" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" /> <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.9.RELEASE" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-core:4.0.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.14" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.0.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.14" level="project" /> <orderEntry type="library" name="Maven: net.sf.morph:morph:1.1.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.14" level="project" /> <orderEntry type="library" name="Maven: net.sf.composite:composite:1.1" level="project" />
<orderEntry type="library" name="Maven: net.sf.ezmorph:ezmorph:1.0.6" level="project" />
<orderEntry type="library" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:4.0.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.0.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.0.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.0.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: net.sf.json-lib:json-lib:jdk15:2.4" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.2" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
</component> </component>
</module> </module>
\ No newline at end of file
...@@ -8,4 +8,37 @@ ...@@ -8,4 +8,37 @@
<param-value>UTF-8</param-value> <param-value>UTF-8</param-value>
</context-param> </context-param>
<filter>
<filter-name>OriginFitlerTwice</filter-name>
<filter-class>com.xxxx.controller.OriginFitlerTwice</filter-class>
</filter>
<filter-mapping>
<filter-name>OriginFitlerTwice</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>com.xxxx.controller.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>RegisterServlet</servlet-name>
<servlet-class>com.xxxx.controller.RegisterServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RegisterServlet</servlet-name>
<url-pattern>/RegisterServlet</url-pattern>
</servlet-mapping>
</web-app> </web-app>
\ No newline at end of file
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
}); });
</script> </script>
<%--上述功能为登录验证码部分--%> <%--上述功能为登录验证码部分--%>
</head> </head>
<body> <body>
<form action="loginServlet" method="post"> <form action="loginServlet" method="post">
...@@ -38,5 +40,6 @@ ...@@ -38,5 +40,6 @@
<span style="color: red;font-size: 12px">${msg}</span> <span style="color: red;font-size: 12px">${msg}</span>
<a href="register.jsp">注册</a> <a href="register.jsp">注册</a>
</form> </form>
</body> </body>
</html> </html>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: lenovo
Date: 2022/2/25
Time: 9:53
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>管理者</title>
</head>
<body>
<td>
:管理者页面
</td>
</body>
</html>
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
To change this template use File | Settings | File Templates. To change this template use File | Settings | File Templates.
--%> --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<title>Title</title> <title>Title</title>
...@@ -74,12 +75,13 @@ ...@@ -74,12 +75,13 @@
<input type="text" name="qq_mail" /> <input type="text" name="qq_mail" />
</td> </td>
</tr> </tr>
<tr>
</table> </table>
<input type="submit" value="提交" /> <input type="submit" value="提交" />
<span style="color: rgba(0,0,0,0.5);font-size: 12px">${ms}</span> <span style="color: rgba(0,0,0,0.5);font-size: 12px">${ms}</span>
</form> </form>
</fieldset> </fieldset>
</body> </body>
......
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.12</version> <version>4.12</version>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>org.springframework.boot</groupId> <!-- <groupId>org.springframework.boot</groupId>-->
<artifactId>spring-boot</artifactId> <!-- <artifactId>spring-boot</artifactId>-->
<version>2.2.6.RELEASE</version> <!-- <version>2.2.6.RELEASE</version>-->
</dependency> <!-- </dependency>-->
<!--jedis 代码中使用这个链接redis --> <!--jedis 代码中使用这个链接redis -->
<dependency> <dependency>
<groupId>com.auth0</groupId> <groupId>com.auth0</groupId>
...@@ -49,45 +49,124 @@ ...@@ -49,45 +49,124 @@
<!--qq邮箱验证所需的依赖 --> <!--qq邮箱验证所需的依赖 -->
<!-- https://mvnrepository.com/artifact/com.sun.mail/javax.mail --> <!-- https://mvnrepository.com/artifact/com.sun.mail/javax.mail -->
<dependency> <dependency>
<groupId>com.sun.mail</groupId> <groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId> <artifactId>javax.mail</artifactId>
<version>1.6.2</version> <version>1.5.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.0.7.RELEASE</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans --> <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId> <artifactId>spring-beans</artifactId>
<version>5.2.9.RELEASE</version> <version>4.0.7.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.morph/morph -->
<dependency>
<groupId>net.sf.morph</groupId>
<artifactId>morph</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.ezmorph/ezmorph -->
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
<version>0.0.20131108.vaadin1</version>
<scope>compile</scope>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support --> <!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId> <artifactId>spring-context-support</artifactId>
<version>5.3.14</version> <version>4.0.7.RELEASE</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<!-- JSONObject依赖包 -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>net.sf.json-lib</groupId>
<artifactId>spring-core</artifactId> <artifactId>json-lib</artifactId>
<version>5.3.14</version> <version>2.4</version>
<classifier>jdk15</classifier>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-collections/commons-collections -->
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.ezmorph/ezmorph -->
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
<version>1.0.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.json-lib/json-lib -->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
</dependencies> </dependencies>
......
package com.xxxx.controller;
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 java.io.IOException;
import java.sql.*;
import java.util.UUID;
/**
* @author yanchaochao
* @date 2022/2/25 18:22
*/
public class LoginJudge {
public static boolean loginSuccess = false;
public static int Judge(String student_id, String user_password) {
String[] manage_account = new String[]{"2021001001", "2021001002", "2021001003", "2021001004", "2021001005"};
String[] manage_password = new String []{"123456", "123456", "123456", "123456", "123456" };
for (int i = 0; i < manage_account.length; i++) {
if (manage_account[i].equals(student_id)) {
for (int j = 0; j < manage_password.length; j++) {
if (manage_password[j].equals(user_password)) {
// if (code != null && code.equalsIgnoreCase(userCode)) {
// //验证码正确的话
// //跳转管理者页面
// return;
// }
return 1;
}
}
}
}
//JDBC代码
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
//1.注册驱动
Class.forName("java.sql.Driver");
//2.获取连接
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "15135757306ycc");
//3.获取数据库操作对象
stmt = conn.createStatement();
//4.执行sql
String sql = "select * from user where student_id='" + student_id + "' and user_password='" + user_password + "' ";
rs = stmt.executeQuery(sql);
//5.处理结果集
// if (rs.next() && code != null && code.equalsIgnoreCase(userCode)) {
if (rs.next()) {
//第一个是检查账号密码是否正确
//第二个是为了防止空指针
//忽略大小写
//登录成功
loginSuccess = true;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
//6.释放资源
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
if (loginSuccess) {
//用户登录成功
return 2;
} else {
//用户登录失败
return 0;
}
}
}
package com.xxxx.controller; package com.xxxx.controller;
/**
* @author yanchaochao
* @date 2022/2/25 18:12
*/
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import java.io.IOException; import java.io.IOException;
import java.sql.*; import java.io.InputStreamReader;
import java.util.UUID; import java.io.PrintWriter;
/** import java.nio.charset.StandardCharsets;
* @author yanchaochao import java.util.ArrayList;
* @date 2022/1/
*/
@WebServlet("/loginServlet") @Configuration
public class LoginServlet extends HttpServlet { public class LoginServlet extends HttpServlet {
static boolean loginSuccess=false;
@Override @Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//设置客户端的编码格式(防止乱码) //设置客户端的编码格式(防止乱码)
HttpSession session = req.getSession(); HttpSession session = request.getSession();
req.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=utf-8");
resp.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("utf-8");
resp.setContentType("text/html");
//接受客户端传递的参数 //fastjson
String student_id = req.getParameter("student_id"); InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
String user_password = req.getParameter("user_password"); StringBuilder click_top_print = new StringBuilder();
String userCode = req.getParameter("checkCode");
//提取session中 int respInt = inputStreamReader.read();
String code =session.getAttribute("checkCode_session").toString(); while (respInt != -1) {
//删除验证码,这样返回的时候验证码就会重新刷一次 click_top_print.append((char) respInt);
session.removeAttribute("checkCode_session"); respInt = inputStreamReader.read();
//JDBC代码
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
//1.注册驱动
Class.forName("java.sql.Driver");
//2.获取连接
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","15135757306ycc");
//3.获取数据库操作对象
stmt = conn.createStatement();
//4.执行sql
String sql ="select * from user where student_id='"+student_id+"' and user_password='"+user_password+"' ";
rs = stmt.executeQuery(sql);
//5.处理结果集
if (rs.next()&&code!=null&&code.equalsIgnoreCase(userCode)){
//第一个是检查账号密码是否正确
//第二个是为了防止空指针
//忽略大小写
//登录成功
loginSuccess = true;
}
}catch (Exception e){
e.printStackTrace();
}finally {
//6.释放资源
if(rs !=null){
try {
rs.close();
}catch (SQLException e){
e.printStackTrace();
}
}
if(stmt!=null){
try {
stmt.close();
}catch (SQLException e){
e.printStackTrace();
}
}
if(conn !=null){
try {
conn.close();
}catch (SQLException e){
e.printStackTrace();
}
}
}
if(loginSuccess){
//登录成功
String token = UUID.randomUUID().toString();
//设置登录信息到session
req.getSession().setAttribute("student_id",user_password);
//跳转到index.jsp
resp.sendRedirect("login.jsp");
}
else{
//提示用户信息
req.setAttribute("msg", "登录失败");
//请求转发跳转到login.jsp
req.getRequestDispatcher("index.jsp").forward(req, resp);
} }
}
}
String jsonString = String.valueOf(click_top_print);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String student_id = a.getString("login_stnum");
String user_password = a.getString("login_input_password");
//String userCode = a.getString("login_input_password");
//提取session中
// String code =session.getAttribute("checkCode_session").toString();
String json = null;
PrintWriter out = response.getWriter();
// if (code.equals(userCode)) {
int s= LoginJudge.Judge(student_id,user_password);
json = JSON.toJSONString(s);
out.print(json);
}
}
\ No newline at end of file
package com.xxxx.controller;
/**
* @author yanchaochao
* @date 2022/2/25 18:09
*/
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 java.io.IOException;
import java.sql.*;
import java.util.UUID;
/**
* @author yanchaochao
* @date 2022/1/
*/
@WebServlet("/loginServlet")
public class Login_Servlet extends HttpServlet {
boolean loginSuccess=false;
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//设置客户端的编码格式(防止乱码)
HttpSession session = req.getSession();
req.setCharacterEncoding("UTF-8");
resp.setCharacterEncoding("UTF-8");
resp.setContentType("text/html");
//接受客户端传递的参数
String student_id = req.getParameter("student_id");
String user_password = req.getParameter("user_password");
String userCode = req.getParameter("checkCode");
//提取session中
String code =session.getAttribute("checkCode_session").toString();
//删除验证码,这样返回的时候验证码就会重新刷一次
session.removeAttribute("checkCode_session");
String[] manage_account = new String[] { "2021006144", "2021006101", "2021006102" };
String[] manage_password = new String[] { "123456ycc", "123456swt", "123456llh" };
for (int i = 0; i < manage_account.length; i++) {
if (manage_account[i].equals(student_id)) {
for (int j = 0; j < manage_password.length; j++) {
if (manage_password[j].equals(user_password)) {
if (code!=null&&code.equalsIgnoreCase(userCode)) {
resp.sendRedirect("manger.jsp");
return ;
}
}
}
}
}
//JDBC代码
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
//1.注册驱动
Class.forName("java.sql.Driver");
//2.获取连接
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","15135757306ycc");
//3.获取数据库操作对象
stmt = conn.createStatement();
//4.执行sql
String sql ="select * from user where student_id='"+student_id+"' and user_password='"+user_password+"' ";
rs = stmt.executeQuery(sql);
//5.处理结果集
if (rs.next()&&code!=null&&code.equalsIgnoreCase(userCode)){
//第一个是检查账号密码是否正确
//第二个是为了防止空指针
//忽略大小写
//登录成功
loginSuccess = true;
}
}catch (Exception e){
e.printStackTrace();
}finally {
//6.释放资源
if(rs !=null){
try {
rs.close();
}catch (SQLException e){
e.printStackTrace();
}
}
if(stmt!=null){
try {
stmt.close();
}catch (SQLException e){
e.printStackTrace();
}
}
if(conn !=null){
try {
conn.close();
}catch (SQLException e){
e.printStackTrace();
}
}
}
if(loginSuccess){
//登录成功
resp.sendRedirect("login.jsp");
}
else{
//提示用户信息
req.setAttribute("msg", "登录失败");
//请求转发跳转到login.jsp
req.getRequestDispatcher("index.jsp").forward(req, resp);
}
}
}
package com.xxxx.controller;
/**
* @author yanchaochao
* @date 2022/2/25 21:29
*/
import org.springframework.context.annotation.Configuration;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
//
//@CrossOrigin(origins = "*", maxAge = 3600)
@WebFilter(filterName = "OriginFilter")
public class OriginFitlerTwice implements javax.servlet.Filter{
@Override
public void destroy(){
}
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
System.out.println("uuuuu");
HttpServletResponse response = (HttpServletResponse) res;
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "*");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "*");
response.setHeader("Access-Control-Allow-Credentials", "true");
System.out.println("oooooooo");
chain.doFilter(req, res);
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
}
package com.xxxx.controller; package com.xxxx.controller;
/**
* @author yanchaochao
* @date 2022/2/23 21:29
*/
import java.util.Properties; import java.util.Properties;
...@@ -32,10 +26,6 @@ public class QQ_mail { ...@@ -32,10 +26,6 @@ public class QQ_mail {
private final static String AUTH_CODE = "iquvlogbzzggdjgc"; //QQ授权码(需要到https://mail.qq.com/申请) private final static String AUTH_CODE = "iquvlogbzzggdjgc"; //QQ授权码(需要到https://mail.qq.com/申请)
private static final JavaMailSenderImpl senderImpl = new JavaMailSenderImpl(); private static final JavaMailSenderImpl senderImpl = new JavaMailSenderImpl();
/* /*
*发送QQ邮件的初始化配置 *发送QQ邮件的初始化配置
*/ */
...@@ -62,11 +52,10 @@ public class QQ_mail { ...@@ -62,11 +52,10 @@ public class QQ_mail {
/** /**
* 发送qq邮件 * 发送qq邮件
* @param qqid * @param qqid
*/ */
public static void send_qq_mail(String qqid) { public static void send_qq_mail(String qqid) {
String[] str = new String[3]; String[] str = new String[3];
str[0] = qqid; str[0] = qqid;
str[1] = "亲爱的云子,您于借的《》已到归还时间,请在前归还该书籍,若有问题请及时联系管理员处理,电话为。"; str[1] = "亲爱的云子,您于借的《》已到归还时间,请在前归还该书籍,若有问题请及时联系管理员处理,电话为。";
...@@ -147,93 +136,3 @@ public class QQ_mail { ...@@ -147,93 +136,3 @@ public class QQ_mail {
} }
// public static void main(String[] args) {
//
// String[] str = new String[3];
//
// str[0] = "E:\\_JAVA\\图书借阅管理系统\\qqmail\\account.txt";
//// str[0] = "705054686@qq.com";
// str[1] = "亲爱的孙智桐云子,您于${borrow_time}借的${book_name}已到归还时间,请在${deaed_time}前归还该书籍,若有问题请及时联系管理员处理,电话为${phone_number}";
//
// str[2] = "【云淄】超时提醒";
//
// send(str);
// }
// public static void send(String [] str)
//
// {
//
// if(str.length != 3){//判断输入参数是否正确
//
// System.out.println("请输入正确的参数,分别是文件名、邮件主题和邮件内容");
//
// return;
//
// }
//
// try {
//
////建立输入缓冲流,读取邮箱账号文件信息
//
// BufferedReader reader = new BufferedReader(new FileReader(str[0]));
//
////创建一个存储账号信息
//
// StringBuilder builder = new StringBuilder();
//
////遍历账号信息
//
// String line = "" ;
//
// int index = 0 ;//索引
//
// while ((line = reader.readLine()) != null) {//readLine()读取一个文本行
//
//// while (index <= str) {//readLine()读取一个文本行
////取出两边空格
//
// line = line.trim();//trim()去掉字符串前后的空格
//
//// char a = line.charAt(index);
// //判断该行是否为空
//
// if (line.equals(""))
//
// continue;
//
////把读取到的邮箱帐号添加到builder中,多个值用逗号分隔
//
// if (index == 0) {
//
// builder.append(line);//append(line)追加数据
//
// } else {
//
// builder.append("," + line);
//
// }
//
// index++;
// }
////把字符串切割成数组array
// //toString()将对象中的数据以字符串的形式返回
// //split(",")将当前字符串以,字符串隔开,隔开后的片段以String[]形式返回。
// String[] accounts = builder.toString().split(",");
//
////发送邮件,args[1] 邮件主题,args[2] 邮件内容
//
// sendSimpleMail(accounts, str[1], str[2]);
//
// } catch (Exception e) {
//
// e.printStackTrace();
//
// }
//
// System.out.println(" 邮件发送成功.. ");
//
// }
//
//}
...@@ -7,12 +7,15 @@ import javax.servlet.http.HttpServletResponse; ...@@ -7,12 +7,15 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.sql.*; import java.sql.*;
import java.util.UUID; import java.util.UUID;
import javax.servlet.http.HttpSession;
/** /**
* @author yanchaochao * @author yanchaochao
* 2022/2/21 15:14 * 2022/2/21 15:14
*/ */
@WebServlet(urlPatterns = "/register") @WebServlet(urlPatterns = "/register")
public class Register extends HttpServlet { public class Register extends HttpServlet {
//数字 //数字
...@@ -30,6 +33,11 @@ public class Register extends HttpServlet { ...@@ -30,6 +33,11 @@ public class Register extends HttpServlet {
} }
@Override @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//设置客户端的编码格式(防止乱码)
HttpSession session = req.getSession();
req.setCharacterEncoding("UTF-8");
resp.setCharacterEncoding("UTF-8");
resp.setContentType("text/html");
//获取在web.xml中的配置的全局属性 //获取在web.xml中的配置的全局属性
String encode = req.getServletContext().getInitParameter("encode"); String encode = req.getServletContext().getInitParameter("encode");
//为了防止乱码设置编码 //为了防止乱码设置编码
...@@ -52,6 +60,7 @@ public class Register extends HttpServlet { ...@@ -52,6 +60,7 @@ public class Register extends HttpServlet {
System.out.println(repassword); System.out.println(repassword);
System.out.println(phone_number); System.out.println(phone_number);
System.out.println(qq_mail); System.out.println(qq_mail);
Send.send("2895548613@qq.com");
//--------------------------------------------------------------- //---------------------------------------------------------------
/* /*
判断区域 判断区域
...@@ -59,16 +68,11 @@ public class Register extends HttpServlet { ...@@ -59,16 +68,11 @@ public class Register extends HttpServlet {
2.密码长度判断 2.密码长度判断
3.密码和确认密码是否一致 3.密码和确认密码是否一致
*/ */
//判断信息是否填写
if(username.equals("") || user_password.equals("") || repassword.equals("") || phone_number.equals("") || student_id.equals("")|| qq_mail.equals("") ){ if(username.equals("") || user_password.equals("") || repassword.equals("") || phone_number.equals("") || student_id.equals("")|| qq_mail.equals("") ){
req.setAttribute("ms", "所有的数据都不能为空"); req.setAttribute("ms", "所有的数据都不能为空");
req.getRequestDispatcher("register.jsp").forward(req, resp); req.getRequestDispatcher("register.jsp").forward(req, resp);
return; return;
} }
System.out.println("555");
SendEmail.qq_mail("2954295419@qq.com");
System.out.println("555");
//判断学号的格式 //判断学号的格式
if(student_id.length()!=10){ if(student_id.length()!=10){
req.setAttribute("ms", "请输入正确的学号格式"); req.setAttribute("ms", "请输入正确的学号格式");
...@@ -138,4 +142,5 @@ public class Register extends HttpServlet { ...@@ -138,4 +142,5 @@ public class Register extends HttpServlet {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
\ No newline at end of file
package com.xxxx.controller;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.UUID;
/**
* @author yanchaochao
* @date 2022/2/25 21:07
*/
public class RegisterJudge {
//数字
public static final String REG_NUMBER = ".*\\d+.*";
//小写字母
public static final String REG_UPPERCASE = ".*[A-Z]+.*";
//大写字母
public static final String REG_LOWERCASE = ".*[a-z]+.*";
//特殊符号
public static final String REG_SYMBOL = ".*[~!@#$%^&*()_+|<>,.?/:;'\\[\\]{}\"]+.*";
//QQ邮箱
public static final String QQ_MAIL = "^[a-zA-Z0-9_-]+@(qq|163)+(\\.(com|cn)+)+$";
public static int Judge(String username, String student_id, String user_password, String repassword, String phone_number, String qq_mail,String user_uuid) {
//String user_uuid = UUID.randomUUID().toString();
if(username.equals("") || user_password.equals("") || repassword.equals("") || phone_number.equals("") || student_id.equals("")|| qq_mail.equals("") ){
//1.所有的数据都不能为空
return 1;
}
//判断学号的格式
if(student_id.length()!=10&&student_id.matches(REG_NUMBER)){
//2.请输入正确的学号格式
return 2;
}
//判断密码长度是否在6-15内
if (user_password.length() >= 15||user_password.length() <= 6) {
//3.密码长度应该在6-15内
return 3;
}
//判断密码是否应包含大小写字母、数字、特殊字符
int i = 0;
if (user_password.matches(REG_NUMBER)) i++;
if (user_password.matches(REG_LOWERCASE))i++;
if (user_password.matches(REG_UPPERCASE)) i++;
if (user_password.matches(REG_SYMBOL)) i++;
if (i < 3 ){
//4.密码应包含大小写字母、数字、特殊字符
return 4;
}
//判断手机号码的格式
if(phone_number.length()==10){
//5.请输入正确的手机号码
return 5;
}
//判断两次密码是否一致
if(!user_password.equals(repassword)){
//6.两次密码输入不一致
return 6;
}
//判断邮箱格式
// 获取邮箱中"@"符号的位置
// int indexone = qq_mail.indexOf("@");
// // 获取邮箱中"."号的位置
// int indextow = qq_mail.indexOf('.');
if (!qq_mail.matches(QQ_MAIL)) {
return 9;
}
//-----------------------------------------------
try {
//加载MySQL的数据库驱动
Class.forName("com.mysql.jdbc.Driver");
//添加了一个名为day02的数据库
String url = "jdbc:mysql://localhost:3306/test";
//默认是系统管理员的账户
String user = "root";
//这里你自己设置的数据库密码
String passw = "15135757306ycc";
//获取到数据库的连接
Connection connection = DriverManager.getConnection(url, user, passw);
//获取到执行器
Statement stmt = connection.createStatement();
//需要执行的sql语句
String sql = "insert into user values (null,'"+user_uuid+"','"+student_id+"','"+username+"','"+user_password+"','"+phone_number+"','"+qq_mail+"')";
//打印一下sql语句,放在数据库中看是否能将数据添加到数据库中
System.out.println(sql);
//执行sql语句
int a = stmt.executeUpdate(sql);
//添加成功上边这个执行器就会返回1
if(a==1){
//7.注册成功,且返回登录页面
return 7;
}else{
//8.注册失败,返回注册页面重新登录
return 8;
}
}catch (Exception e){
e.printStackTrace();
}
return 0;
}
}
package com.xxxx.controller;
/**
* @author yanchaochao
* @date 2022/2/25 20:38
*/
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.annotation.Configuration;
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.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@Configuration
public class RegisterServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
//fastjson
InputStreamReader inputStreamReader = new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8);
StringBuilder click_top_print = new StringBuilder();
int respInt = inputStreamReader.read();
while (respInt != -1) {
click_top_print.append((char) respInt);
respInt = inputStreamReader.read();
}
System.out.println("gggggg");
String jsonString = String.valueOf(click_top_print);// 将 char 数组 data 转换成字符串
JSONObject a = JSON.parseObject(jsonString);
String username = a.getString("username");
String student_id = a.getString("student_id");
String user_password = a.getString("user_password");
String repassword = a.getString("repassword");
String phone_number = a.getString("phone_number");
String qq_mail = a.getString("qq_mail");
String user_uuid = UUID.randomUUID().toString();
// System.out.println("aaaaa");
// System.out.println(username+" "+student_id);
ArrayList<Object> array = new ArrayList<>();
// String json = null;
PrintWriter out = response.getWriter();
int s= RegisterJudge.Judge(username,student_id,user_password,repassword,phone_number,qq_mail,user_uuid);
// json = JSON.toJSONString(s);
// array.add(s);
// array.add(user_uuid);
// array.add(username);
Map map = new HashMap();
map.put("returnvalue",s);
map.put("user_uuid",user_uuid);
map.put("username",username);
JSONObject c = JSONObject.parseObject(JSON.toJSONString(map));
out.println(c);
}
}
package com.xxxx.controller;
import javax.mail.*;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.Properties;
/**
* @author yanchaochao
* @date 2022/2/26 11:41
*/
public class Send {
public static String send( String qq_mail) {
try {
//创建Properties 类用于记录邮箱的一些属性
final Properties props = new Properties();
//表示SMTP发送邮件,必须进行身份验证
props.put("mail.smtp.auth", "true");
//此处填写SMTP服务器
props.put("mail.smtp.host", "smtp.qq.com");
//端口号,QQ邮箱给出了两个端口,但是另一个我一直使用不了,所以就给出这一个587
props.put("mail.smtp.port", "587");
//此处填写你的账号
props.put("mail.user", "2673408959@qq.com");
//此处的密码就是前面说的16位STMP口令
props.put("mail.password", "iquvlogbzzggdjgc");
//构建授权信息,用于进行SMTP进行身份验证
Authenticator authenticator = new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
// 用户名、密码
String userName = props.getProperty("mail.user");
String password = props.getProperty("mail.password");
return new PasswordAuthentication(userName, password);
}
};
//使用环境属性和授权信息,创建邮件会话
Session mailSession = Session.getInstance(props, authenticator);
//创建邮件消息
MimeMessage message = new MimeMessage(mailSession);
//设置发件人
InternetAddress form = new InternetAddress(
props.getProperty("mail.user"));
message.setFrom(form);
//设置收件人的邮箱
InternetAddress to = new InternetAddress(qq_mail);
message.setRecipient(Message.RecipientType.TO, to);
//设置邮件标题
message.setSubject("测试邮件");
String msg = "emm";
//html文件
StringBuilder sb = new StringBuilder();
sb.append("<html>");
sb.append("<head>");
sb.append("<title>xxx</title>");
sb.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
sb.append("<style type=\"text/css\">");
sb.append(".post {margin-bottom: 20px;background: #5BCE9E;}.title {padding: 5px 20px;}.posted {padding: 0 0 0 20px;font-size: small;}.story {padding: 20px;}.meta {height: 60px;padding: 40px 0 0 0;}.meta p {margin: 0;padding: 0 20px 0 0; text-align: right;}");
sb.append("</style>");
sb.append("</head>");
sb.append("<body>");
sb.append("<div>");
sb.append("<div class=\"post\">");
sb.append("<h2 class=\"title\">某某某</h2>");
sb.append("<h3 class=\"posted\">这是一条来自xxx系统xxx的xxx</h3>");
sb.append("<div class=\"story\">"+msg+"</div>");
sb.append("<div class=\"meta\"><p>xxxx年xx月xx时xx分</p></div>");
sb.append("</div>");
sb.append("</div>");
sb.append("</body>");
sb.append("</html>");
//设置邮件的内容体
message.setContent(sb.toString(), "text/html;charset=UTF-8");
//最后当然就是发送邮件啦
Transport.send(message);
} catch (AddressException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return qq_mail;
}
}
package com.xxxx.controller; package com.xxxx.controller;
/**
* @author yanchaochao
* @date 2022/2/24 12:59
*/
import java.util.Properties; import java.util.Properties;
import java.util.Random;
import javax.mail.Authenticator; import javax.mail.Authenticator;
import javax.mail.Message.RecipientType; import javax.mail.Message.RecipientType;
...@@ -19,8 +13,7 @@ import javax.mail.internet.MimeMessage; ...@@ -19,8 +13,7 @@ import javax.mail.internet.MimeMessage;
public class SendEmail { public class SendEmail {
public static void main(String[] args) {
public static void qq_mail(String qqid) {
try { try {
//创建Properties 类用于记录邮箱的一些属性 //创建Properties 类用于记录邮箱的一些属性
final Properties props = new Properties(); final Properties props = new Properties();
...@@ -31,9 +24,9 @@ public class SendEmail { ...@@ -31,9 +24,9 @@ public class SendEmail {
//端口号,QQ邮箱给出了两个端口,但是另一个我一直使用不了,所以就给出这一个587 //端口号,QQ邮箱给出了两个端口,但是另一个我一直使用不了,所以就给出这一个587
props.put("mail.smtp.port", "587"); props.put("mail.smtp.port", "587");
//此处填写你的账号 //此处填写你的账号
props.put("mail.user", "2895548613@qq.com"); props.put("mail.user", "2673408959@qq.com");
//此处的密码就是前面说的16位STMP口令 //此处的密码就是前面说的16位STMP口令
props.put("mail.password", "cgryarketubyddih"); props.put("mail.password", "iquvlogbzzggdjgc");
//构建授权信息,用于进行SMTP进行身份验证 //构建授权信息,用于进行SMTP进行身份验证
Authenticator authenticator = new Authenticator() { Authenticator authenticator = new Authenticator() {
...@@ -54,13 +47,13 @@ public class SendEmail { ...@@ -54,13 +47,13 @@ public class SendEmail {
message.setFrom(form); message.setFrom(form);
//设置收件人的邮箱 //设置收件人的邮箱
InternetAddress to = new InternetAddress(qqid); InternetAddress to = new InternetAddress("2954295419@qq.com");
message.setRecipient(RecipientType.TO, to); message.setRecipient(RecipientType.TO, to);
//设置邮件标题 //设置邮件标题
message.setSubject("测试邮件"); message.setSubject("测试邮件");
String msg = "吃了"; String msg = "emm";
//html文件 //html文件
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("<html>"); sb.append("<html>");
...@@ -96,7 +89,6 @@ public class SendEmail { ...@@ -96,7 +89,6 @@ public class SendEmail {
e.printStackTrace(); e.printStackTrace();
} }
}
}
}
}
\ No newline at end of file
...@@ -8,4 +8,37 @@ ...@@ -8,4 +8,37 @@
<param-value>UTF-8</param-value> <param-value>UTF-8</param-value>
</context-param> </context-param>
<filter>
<filter-name>OriginFitlerTwice</filter-name>
<filter-class>com.xxxx.controller.OriginFitlerTwice</filter-class>
</filter>
<filter-mapping>
<filter-name>OriginFitlerTwice</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>com.xxxx.controller.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>RegisterServlet</servlet-name>
<servlet-class>com.xxxx.controller.RegisterServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RegisterServlet</servlet-name>
<url-pattern>/RegisterServlet</url-pattern>
</servlet-mapping>
</web-app> </web-app>
\ No newline at end of file
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
}); });
</script> </script>
<%--上述功能为登录验证码部分--%> <%--上述功能为登录验证码部分--%>
</head> </head>
<body> <body>
<form action="loginServlet" method="post"> <form action="loginServlet" method="post">
...@@ -38,5 +40,6 @@ ...@@ -38,5 +40,6 @@
<span style="color: red;font-size: 12px">${msg}</span> <span style="color: red;font-size: 12px">${msg}</span>
<a href="register.jsp">注册</a> <a href="register.jsp">注册</a>
</form> </form>
</body> </body>
</html> </html>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: lenovo
Date: 2022/2/25
Time: 9:53
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>管理者</title>
</head>
<body>
<td>
:管理者页面
</td>
</body>
</html>
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
To change this template use File | Settings | File Templates. To change this template use File | Settings | File Templates.
--%> --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<title>Title</title> <title>Title</title>
...@@ -74,12 +75,13 @@ ...@@ -74,12 +75,13 @@
<input type="text" name="qq_mail" /> <input type="text" name="qq_mail" />
</td> </td>
</tr> </tr>
<tr>
</table> </table>
<input type="submit" value="提交" /> <input type="submit" value="提交" />
<span style="color: rgba(0,0,0,0.5);font-size: 12px">${ms}</span> <span style="color: rgba(0,0,0,0.5);font-size: 12px">${ms}</span>
</form> </form>
</fieldset> </fieldset>
</body> </body>
......
...@@ -41,7 +41,7 @@ window.onload=function(){ ...@@ -41,7 +41,7 @@ window.onload=function(){
} }
} }
axios.defaults.baseURL = "http://eebw6y.natappfree.cc" axios.defaults.baseURL = "http://85iunn.natappfree.cc"
// let message = new Array(3) // let message = new Array(3)
// message[0]={ // message[0]={
...@@ -163,7 +163,7 @@ window.alert = function(msg){ ...@@ -163,7 +163,7 @@ window.alert = function(msg){
// 点击登录传入数据(学号,密码) // 点击登录传入数据(学号,密码)0输入错误,1跳转使用者,2管理者
$('button#login_body_button_one').click(function login_input(){ $('button#login_body_button_one').click(function login_input(){
let login_stnum=$('#login_body_input_one').val(); let login_stnum=$('#login_body_input_one').val();
let login_password=$('#login_body_input_two').val(); let login_password=$('#login_body_input_two').val();
...@@ -183,10 +183,10 @@ $('button#login_body_button_one').click(function login_input(){ ...@@ -183,10 +183,10 @@ $('button#login_body_button_one').click(function login_input(){
alert('输入错误'); alert('输入错误');
}else if(login_num==1){ }else if(login_num==1){
localStorage.setItem('user_uuid',login_num); localStorage.setItem('user_uuid',login_num);
window.location.href = '../../首页/library_home.html'; window.location.href = '../../../使用者/item/User/User.html';
}else{ }else{
localStorage.setItem('user_uuid',login_num); localStorage.setItem('user_uuid',login_num);
window.location.href = '../../index.html'; window.location.href = '../../../管理者/html/applyBook.html';
} }
}) })
}) })
......
window.onload = function () window.onload = function ()
window.onload = function () window.onload = function ()
{ {
axios.defaults.baseURL = "http://fx86f6.natappfree.cc" axios.defaults.baseURL = "http://kkrb4k.natappfree.cc"
function render() { function render() {
axios({ axios({
method: 'post', method: 'post',
......
window.onload = function () window.onload = function ()
window.onload = function () window.onload = function ()
{ {
axios.defaults.baseURL = "http://fx86f6.natappfree.cc" axios.defaults.baseURL = "http://892qcp.natappfree.cc"
function render() { function render() {
axios({ axios({
method: 'post', method: 'post',
......
window.onload = function () window.onload = function ()
window.onload = function () window.onload = function ()
{ {
axios.defaults.baseURL = "http://fx86f6.natappfree.cc" //axios.defaults.baseURL = "http://kkrb4k.natappfree.cc"
for(let i=0;i<res.length;i++) for(let i=0;i<res.length;i++)
{ {
console.log('a')
$("<div class='book'></div>").appendTo($('.bookbox')); $("<div class='book'></div>").appendTo($('.bookbox'));
} }
...@@ -32,7 +32,7 @@ window.onload = function () ...@@ -32,7 +32,7 @@ window.onload = function ()
document.getElementsByClassName('alert-see-sure-button')[0].addEventListener('click',()=>{ document.getElementsByClassName('alert-see-sure-button')[0].addEventListener('click',()=>{
$('.alert-see-sure').hide(); $('.alert-see-sure').hide();
document.getElementsByClassName('book')[i].style.display='none'; document.getElementsByClassName('book')[i].style.display='none';
}) })
}) })
......
window.onload = function () window.onload = function ()
window.onload = function () window.onload = function ()
{ {
axios.defaults.baseURL = "http://fx86f6.natappfree.cc" axios.defaults.baseURL = "http://kkrb4k.natappfree.cc"
function render() { function render() {
axios({ axios({
method: 'post', method: 'post',
......
window.onload = function () window.onload = function ()
window.onload = function () window.onload = function ()
{ {
axios.defaults.baseURL = "http://fx86f6.natappfree.cc" axios.defaults.baseURL = "http://kkrb4k.natappfree.cc"
function render() { function render() {
axios({ axios({
method: 'post', method: 'post',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment