Compare commits

...

No commits in common. 'main' and 'a_branch' have entirely different histories.

@ -1 +0,0 @@
Subproject commit 495661ee0f0688985eec8f3c1099260d0e6558ec

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="recruit" />
</profile>
</annotationProcessing>
</component>
</project>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_24" default="true" project-jdk-name="24" project-jdk-type="JavaSDK" />
</project>

@ -32,11 +32,6 @@
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.19.0</version>
</dependency>
</dependencies>
<build>
<finalName>recruit</finalName>

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="recruit" />
</profile>
</annotationProcessing>
</component>
</project>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_24" default="true" project-jdk-name="24" project-jdk-type="JavaSDK" />
</project>

@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}

@ -0,0 +1,44 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>recruit</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>recruit Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0-M1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
</dependency>
</dependencies>
<build>
<finalName>recruit</finalName>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>24</maven.compiler.source>
<maven.compiler.target>24</maven.compiler.target>
</properties>
</project>

@ -0,0 +1,64 @@
package com.example.bean;
public class ApplicationBean {
private String name;
private int degrees;
private String major;
private String hobby;
private String accountID;
public String getName()
{
return name;
}
public int getDegrees()
{
return degrees;
}
public String getMajor()
{
return major;
}
public String getHobby()
{
return hobby;
}
public String getAccountID()
{
return accountID;
}
public void setName(String name)
{
this.name=name;
}
public void setDegrees(int degrees)
{
this.degrees=degrees;
}
public void setMajor(String major)
{
this.major=major;
}
public void setHobby(String hobby)
{
this.hobby=hobby;
}
public void setAccountID(String accountID)
{
this.accountID=accountID;
}
}

@ -0,0 +1,5 @@
package com.example.bean;
public class logSignBean {
}

@ -0,0 +1,37 @@
package com.example.bean;
public class entrepriseProfileBean {
private int designation;
//企业名称
private String text;
//概述
private int boundaccount;
//绑定的账户
public int getDesignation() {
return designation;
}
public String getText() {
return text;
}
public int getBoundaccount() {
return boundaccount;
}
public void setDesignation(int designation) {
this.designation = designation;
}
public void setText(int text) {
this.text = text;
}
public void setBoundaccount(int boundaccount) {
this.boundaccount = boundaccount;
}
}

@ -0,0 +1,82 @@
package com.example.bean;
public class studentProfileBean {
private String name;
private int age;
private String major;
//专业
private String degrees;
//学位
private String hobby;
private int boundaccount;
//绑定的账户
public String getName()
{
return name;
}
public int getAge()
{
return age;
}
public String getMajor()
{
return major;
}
public String getDegrees()
{
return degrees;
}
public String getHobby()
{
return hobby;
}
public int getBoundaccount()
{
return boundaccount;
}
public void setName(String name)
{
this.name=name;
}
public void setAge(int age)
{
this.age=age;
}
public void setMajor(String major)
{
this.major=major;
}
public void setDegrees(String degrees)
{
this.degrees=degrees;
}
public void setHobby(String hobby)
{
this.hobby=hobby;
}
public void setBoundaccount(int boundaccount)
{
this.boundaccount=boundaccount;
}
}

@ -0,0 +1,80 @@
package com.example.dao;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.example.bean.ApplicationBean;
import com.example.bean.RecruitBean;
import com.example.utility.Connect;
public class ApplicationDAO {
Connect connect = new Connect();
public List<ApplicationBean> retrieve(String searchKey) throws SQLException, IOException {
List<ApplicationBean> ApplicationList = new ArrayList<>();
ApplicationBean applicationBean = new ApplicationBean();
String retrieveByName="SELECT * FROM recruit WHERE name LIKE ?";
String retrieveByContent="SELECT * FROM recruit WHERE content LIKE ? ";
String retrieveByLocation="SELECT * FROM recruit WHERE companyID LIKE ? ";
String retrieveByCompany="SELECT * FROM recruit WHERE companyID LIKE ? ";
try (Connection connection = connect.databaseConnect()) {
try (PreparedStatement preparedStatement = connection
.prepareStatement(retrieveByName)) {
preparedStatement.setObject(1, "%"+searchKey+"%");
try (ResultSet resultSet = preparedStatement.executeQuery()) {
while (resultSet.next()) {
ApplicationBean.setName(resultSet.getInt("name"));
ApplicationBean.setDegrees(resultSet.getInt("degrees"));
ApplicationBean.setMajor(resultSet.getString("major"));
ApplicationBean.setHobby(resultSet.getString("hobby"));
ApplicationBean.setAccountID(resultSet.getString("accountID"));
} //把这里封装成方法来简化
} catch (SQLException e) {
System.out.println(e.getMessage());
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
return ApplicationList;
}
public void create(String name, String content, String location, int salary, String company,String companyID)
throws SQLException, IOException {
try (Connection connection = connect.databaseConnect()) {
try (PreparedStatement preparedStatement = connection.prepareStatement(
"INSERT INTO recruit (name, content, location, salary, companyID) VALUES (?,?,?,?,?,?)")) {
preparedStatement.setObject(1, name);
preparedStatement.setObject(2, content);
preparedStatement.setObject(3, location);
preparedStatement.setObject(4, salary);
preparedStatement.setObject(5, companyID);
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
}
/*
* public void update() throws SQLException {
* try (PreparedStatement preparedStatement = connection.prepareStatement(
* "UPDATE recruit SET name=? WHERE id=?")) {
* preparedStatement.executeQuery();
* }
* }
*
* public void delete() throws SQLException
* {
* try (PreparedStatement preparedStatement = connection.prepareStatement(
* "DELETE FROM recruit WHERE id=?")) {
* preparedStatement.executeQuery();
* }
* }
*/
}

@ -0,0 +1,80 @@
package com.example.dao;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.example.bean.ApplicationBean;
import com.example.bean.RecruitBean;
import com.example.utility.Connect;
public class ApplicationDAO {
Connect connect = new Connect();
public List<ApplicationBean> retrieve(String searchKey) throws SQLException, IOException {
List<ApplicationBean> ApplicationList = new ArrayList<>();
ApplicationBean applicationBean = new ApplicationBean();
String retrieveByName="SELECT * FROM recruit WHERE name LIKE ?";
String retrieveByContent="SELECT * FROM recruit WHERE content LIKE ? ";
String retrieveByLocation="SELECT * FROM recruit WHERE companyID LIKE ? ";
String retrieveByCompany="SELECT * FROM recruit WHERE companyID LIKE ? ";
try (Connection connection = connect.databaseConnect()) {
try (PreparedStatement preparedStatement = connection
.prepareStatement(retrieveByName)) {
preparedStatement.setObject(1, "%"+searchKey+"%");
try (ResultSet resultSet = preparedStatement.executeQuery()) {
while (resultSet.next()) {
ApplicationBean.setName(resultSet.getInt("name"));
ApplicationBean.setDegrees(resultSet.getInt("degrees"));
ApplicationBean.setMajor(resultSet.getString("major"));
ApplicationBean.setHobby(resultSet.getString("hobby"));
ApplicationBean.setAccountID(resultSet.getString("accountID"));
} //把这里封装成方法来简化
} catch (SQLException e) {
System.out.println(e.getMessage());
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
return ApplicationList;
}
public void create(String name, String content, String location, int salary, String company,String companyID)
throws SQLException, IOException {
try (Connection connection = connect.databaseConnect()) {
try (PreparedStatement preparedStatement = connection.prepareStatement(
"INSERT INTO recruit (name, content, location, salary, companyID) VALUES (?,?,?,?,?,?)")) {
preparedStatement.setObject(1, name);
preparedStatement.setObject(2, content);
preparedStatement.setObject(3, location);
preparedStatement.setObject(4, salary);
preparedStatement.setObject(5, companyID);
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
}
/*
* public void update() throws SQLException {
* try (PreparedStatement preparedStatement = connection.prepareStatement(
* "UPDATE recruit SET name=? WHERE id=?")) {
* preparedStatement.executeQuery();
* }
* }
*
* public void delete() throws SQLException
* {
* try (PreparedStatement preparedStatement = connection.prepareStatement(
* "DELETE FROM recruit WHERE id=?")) {
* preparedStatement.executeQuery();
* }
* }
*/
}

@ -0,0 +1,22 @@
package com.example.servlet;
import java.io.IOException;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/applicationManage")
public class ApplicationManageServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html");
request.getRequestDispatcher("WEB-INF/jsp/applicationManage.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
doGet(request, response);
}
}

@ -0,0 +1,22 @@
package com.example.servlet;
import java.io.IOException;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/logSign")
public class LogSignServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html");
request.getRequestDispatcher("WEB-INF/jsp/logSign.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
doGet(request, response);
}
}

@ -8,14 +8,15 @@ import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/entrepriseManage")
public class EntrepriseManage extends HttpServlet {
@WebServlet("/")
public class MainPageServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.setCharacterEncoding("utf-8");
request.getRequestDispatcher("WEB-INF/jsp/recruitManageForEntreprise.jsp").forward(request, response);
response.setContentType("text/html");
request.getRequestDispatcher("WEB-INF/jsp/mainPage.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
doGet(request, response);
}
}
}

@ -0,0 +1,22 @@
package com.example.servlet;
import java.io.IOException;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/manage")
public class ManageServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html");
request.getRequestDispatcher("WEB-INF/jsp/manage.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
doGet(request, response);
}
}

@ -0,0 +1,43 @@
package com.example.servlet;
import java.io.IOException;
import java.sql.SQLException;
import com.alibaba.fastjson.JSONObject;
import com.example.dao.RecruitDAO;
import com.example.utility.HttpGetJson;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/profile")
public class ProfileServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.getRequestDispatcher("WEB-INF/jsp/search.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
request.setCharacterEncoding("UTF-8");//请求编码类型
response.setCharacterEncoding("UTF-8");//响应编码类型
response.setContentType("application/json");//响应数据类型
JSONObject searchKey= HttpGetJson.getJson(request);
if (searchKey!=null){
RecruitDAO recruitDAO=new RecruitDAO();
try{
recruitDAO.retrieve("");
}
catch(SQLException e)
{
System.out.println(e.getMessage());
}
}
JSONObject responseSearch=new JSONObject();//即将返回前端数据
responseSearch.put("code",200); //待补充
response.getWriter().write(String.valueOf(responseSearch));
}
}
//参考文章 https://blog.csdn.net/qq_30315977/article/details/119060325

@ -0,0 +1,43 @@
package com.example.servlet;
import java.io.IOException;
import java.sql.SQLException;
import com.alibaba.fastjson.JSONObject;
import com.example.dao.RecruitDAO;
import com.example.utility.HttpGetJson;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/search")
public class SearchServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.getRequestDispatcher("WEB-INF/jsp/search.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
request.setCharacterEncoding("UTF-8");//请求编码类型
response.setCharacterEncoding("UTF-8");//响应编码类型
response.setContentType("application/json");//响应数据类型
JSONObject searchKey= HttpGetJson.getJson(request);
if (searchKey!=null){
RecruitDAO recruitDAO=new RecruitDAO();
try{
recruitDAO.retrieve("");
}
catch(SQLException e)
{
System.out.println(e.getMessage());
}
}
JSONObject responseSearch=new JSONObject();//即将返回前端数据
responseSearch.put("code",200); //待补充
response.getWriter().write(String.valueOf(responseSearch));
}
}
//参考文章 https://blog.csdn.net/qq_30315977/article/details/119060325

@ -13,14 +13,13 @@ public class Connect {
private Connection connection;
public Connection databaseConnect() throws IOException {
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("jdbc.properties");
InputStream inputStream = this.getClass().getResourceAsStream("jdbc.properties");
properties.load(inputStream);
String jdbcUri = properties.getProperty("jdbcUri");
String jdbcUser = properties.getProperty("jdbcUser");
String jdbcPassword = properties.getProperty("jdbcPassword");
String jdbcDriver = properties.getProperty("jdbcDriver");
try {
Class.forName(jdbcDriver);
Class.forName("com.mysql.cj.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}
@ -32,14 +31,12 @@ public class Connect {
return connection;
}
/*
* public int databaseClose() {
* try {
* connection.close();
* } catch (SQLException e) {
* return -1;
* }
* return 0;
* }
*/
/*public int databaseClose() {
try {
connection.close();
} catch (SQLException e) {
return -1;
}
return 0;
}*/
}

@ -31,6 +31,4 @@ public class HttpGetJson {
return (JSONObject) JSONObject.parse(result);
}
}
//参考文章https://blog.csdn.net/weixin_56175092/article/details/126346904
}

@ -0,0 +1,3 @@
jdbcUri=jdbc:mysql://localhost:3306/recruit?useSSL=false&characterEncoding=utf8
jdbcUser=root
jdbcPassword=12345678

@ -0,0 +1,28 @@
function createXMLHttpRequest() {
let xmlHttpRequest = new XMLHttpRequest();
if (window.XMLHttpRequest) { // 非IE浏览器
xmlHttpRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE浏览器
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlHttpRequest;
}
function jsonSend() {
let searchKey=JSON.stringify({searchkey:document.getElementById("searchBox").value});
let xmlHttpRequest = createXMLHttpRequest();
xmlHttpRequest.open("POST", "https://localhost:8080/search", true);
xmlHttpRequest.setRequestHeader("Content-Type", "application/json");
xmlHttpRequest.onreadystatechange = function() {
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
if (xmlHttpRequest.status === 200) {
let responseData = xmlHttpRequest.responseText;
} else {
console.error('Server response error:', xmlHttpRequest.statusText);
}
}
};
xmlHttpRequest.send(seachKey);
}
//参考文章 https://blog.csdn.net/weixin_34718952/article/details/148485765

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>application details</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is application details page</h1>
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>application manage</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is application manage page</h1>
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>entreprise profile</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is entreprise profile page</h1>
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>logSign</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is logSign page</h1>
</body>
</html>

@ -0,0 +1,23 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true" %>
<html>
<head>
<title>mainPage</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is main page</h1>
<a href="http://localhost:8080/recruit/logSign">log/sign up</a>
<br>
<a href="http://localhost:8080/recruit/search">search</a>
<br>
<a href="http://localhost:8080/recruit/applicationManage">applicationManage</a>
<br>
<a href="http://localhost:8080/recruit/profile">profile</a>
<br>
<a href="http://localhost:8080/recruit/manage">manage</a>
<!--待验证权限-->
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>manager to use</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is manager to use page</h1>
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>logSign</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is logSign page</h1>
</body>
</html>

@ -0,0 +1,20 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>search</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="js/search.js"></script>
</head>
<body>
<h1>this is search page</h1>
<div>
<form>
<lable for="searchBox">search:</lable>
<input type="text" id="searchBox" name="searchBox">
<input type="button" value="confirm" onclick="jsonSearch()">
</form>
</div>
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>student profile</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is student profile page</h1>
</body>
</html>

@ -0,0 +1,3 @@
jdbcUri=jdbc:mysql://localhost:3306/recruit?useSSL=false&characterEncoding=utf8
jdbcUser=root
jdbcPassword=12345678

@ -1,13 +1,14 @@
F:\Programme\recruit\recruit\src\main\java\com\example\bean\EntrepriseProfileBean.java
F:\Programme\recruit\recruit\src\main\java\com\example\bean\LogSignBean.java
F:\Programme\recruit\recruit\src\main\java\com\example\bean\accountBean.java
F:\Programme\recruit\recruit\src\main\java\com\example\bean\ApplicationBean.java
F:\Programme\recruit\recruit\src\main\java\com\example\bean\entrepriseProfileBean.java
F:\Programme\recruit\recruit\src\main\java\com\example\bean\RecruitBean.java
F:\Programme\recruit\recruit\src\main\java\com\example\bean\StudentProfileBean.java
F:\Programme\recruit\recruit\src\main\java\com\example\dao\EntrepriseProfileDAO.java
F:\Programme\recruit\recruit\src\main\java\com\example\bean\studentProfileBean.java
F:\Programme\recruit\recruit\src\main\java\com\example\dao\ApplicationDAO.java
F:\Programme\recruit\recruit\src\main\java\com\example\dao\entrepriseProfileDAO.java
F:\Programme\recruit\recruit\src\main\java\com\example\dao\LogSignDAO.java
F:\Programme\recruit\recruit\src\main\java\com\example\dao\RecruitDAO.java
F:\Programme\recruit\recruit\src\main\java\com\example\dao\StudentProfileDAO.java
F:\Programme\recruit\recruit\src\main\java\com\example\listener\SessionListener.java
F:\Programme\recruit\recruit\src\main\java\com\example\servlet\EntrepriseManage.java
F:\Programme\recruit\recruit\src\main\java\com\example\dao\studentProfileDAO.java
F:\Programme\recruit\recruit\src\main\java\com\example\servlet\ApplicationManageServlet.java
F:\Programme\recruit\recruit\src\main\java\com\example\servlet\LogSignServlet.java
F:\Programme\recruit\recruit\src\main\java\com\example\servlet\MainPageServlet.java
F:\Programme\recruit\recruit\src\main\java\com\example\servlet\ManageServlet.java
@ -15,5 +16,3 @@ F:\Programme\recruit\recruit\src\main\java\com\example\servlet\ProfileServlet.ja
F:\Programme\recruit\recruit\src\main\java\com\example\servlet\RecruitServlet.java
F:\Programme\recruit\recruit\src\main\java\com\example\servlet\SearchServlet.java
F:\Programme\recruit\recruit\src\main\java\com\example\utility\Connect.java
F:\Programme\recruit\recruit\src\main\java\com\example\utility\HttpGetJson.java
F:\Programme\recruit\recruit\src\main\java\com\example\utility\SaltMD5Util.java

@ -0,0 +1,64 @@
package com.example.bean;
public class ApplicationBean {
private String name;
private int degrees;
private String major;
private String hobby;
private String accountID;
public String getName()
{
return name;
}
public int getDegrees()
{
return degrees;
}
public String getMajor()
{
return major;
}
public String getHobby()
{
return hobby;
}
public String getAccountID()
{
return accountID;
}
public void setName(String name)
{
this.name=name;
}
public void setDegrees(int degrees)
{
this.degrees=degrees;
}
public void setMajor(String major)
{
this.major=major;
}
public void setHobby(String hobby)
{
this.hobby=hobby;
}
public void setAccountID(String accountID)
{
this.accountID=accountID;
}
}

@ -0,0 +1,99 @@
package com.example.bean;
public class RecruitBean {
private int hits;
private int applications;
private String name;
private String content;
private String location;
private int salary;
private String company;
private String companyID;
public int getHits()
{
return hits;
}
public int getApplications()
{
return applications;
}
public String getName()
{
return name;
}
public String getContent()
{
return content;
}
public String getLocation()
{
return location;
}
public int getSalary()
{
return salary;
}
public String getCompany()
{
return company;
}
public String getCompanyID()
{
return companyID;
}
public void setHits(int hits)
{
this.hits=hits;
}
public void setApplications(int applications)
{
this.applications=applications;
}
public void setName(String name)
{
this.name=name;
}
public void setContent(String content)
{
this.content=content;
}
public void setLocation(String location)
{
this.location=location;
}
public void setSalary(int salary)
{
this.salary=salary;
}
public void setCompanyID(String companyID)
{
this.companyID=companyID;
}
public void setCompany(String company)
{
this.company=company;
}
}

@ -0,0 +1,5 @@
package com.example.bean;
public class logSignBean {
}

@ -0,0 +1,37 @@
package com.example.bean;
public class entrepriseProfileBean {
private int designation;
//企业名称
private String text;
//概述
private int boundaccount;
//绑定的账户
public int getDesignation() {
return designation;
}
public String getText() {
return text;
}
public int getBoundaccount() {
return boundaccount;
}
public void setDesignation(int designation) {
this.designation = designation;
}
public void setText(int text) {
this.text = text;
}
public void setBoundaccount(int boundaccount) {
this.boundaccount = boundaccount;
}
}

@ -0,0 +1,82 @@
package com.example.bean;
public class studentProfileBean {
private String name;
private int age;
private String major;
//专业
private String degrees;
//学位
private String hobby;
private int boundaccount;
//绑定的账户
public String getName()
{
return name;
}
public int getAge()
{
return age;
}
public String getMajor()
{
return major;
}
public String getDegrees()
{
return degrees;
}
public String getHobby()
{
return hobby;
}
public int getBoundaccount()
{
return boundaccount;
}
public void setName(String name)
{
this.name=name;
}
public void setAge(int age)
{
this.age=age;
}
public void setMajor(String major)
{
this.major=major;
}
public void setDegrees(String degrees)
{
this.degrees=degrees;
}
public void setHobby(String hobby)
{
this.hobby=hobby;
}
public void setBoundaccount(int boundaccount)
{
this.boundaccount=boundaccount;
}
}

@ -0,0 +1,80 @@
package com.example.dao;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.example.bean.ApplicationBean;
import com.example.bean.RecruitBean;
import com.example.utility.Connect;
public class ApplicationDAO {
Connect connect = new Connect();
public List<ApplicationBean> retrieve(String searchKey) throws SQLException, IOException {
List<ApplicationBean> ApplicationList = new ArrayList<>();
ApplicationBean applicationBean = new ApplicationBean();
String retrieveByName="SELECT * FROM recruit WHERE name LIKE ?";
String retrieveByContent="SELECT * FROM recruit WHERE content LIKE ? ";
String retrieveByLocation="SELECT * FROM recruit WHERE companyID LIKE ? ";
String retrieveByCompany="SELECT * FROM recruit WHERE companyID LIKE ? ";
try (Connection connection = connect.databaseConnect()) {
try (PreparedStatement preparedStatement = connection
.prepareStatement(retrieveByName)) {
preparedStatement.setObject(1, "%"+searchKey+"%");
try (ResultSet resultSet = preparedStatement.executeQuery()) {
while (resultSet.next()) {
ApplicationBean.setName(resultSet.getInt("name"));
ApplicationBean.setDegrees(resultSet.getInt("degrees"));
ApplicationBean.setMajor(resultSet.getString("major"));
ApplicationBean.setHobby(resultSet.getString("hobby"));
ApplicationBean.setAccountID(resultSet.getString("accountID"));
} //把这里封装成方法来简化
} catch (SQLException e) {
System.out.println(e.getMessage());
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
return ApplicationList;
}
public void create(String name, String content, String location, int salary, String company,String companyID)
throws SQLException, IOException {
try (Connection connection = connect.databaseConnect()) {
try (PreparedStatement preparedStatement = connection.prepareStatement(
"INSERT INTO recruit (name, content, location, salary, companyID) VALUES (?,?,?,?,?,?)")) {
preparedStatement.setObject(1, name);
preparedStatement.setObject(2, content);
preparedStatement.setObject(3, location);
preparedStatement.setObject(4, salary);
preparedStatement.setObject(5, companyID);
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
}
/*
* public void update() throws SQLException {
* try (PreparedStatement preparedStatement = connection.prepareStatement(
* "UPDATE recruit SET name=? WHERE id=?")) {
* preparedStatement.executeQuery();
* }
* }
*
* public void delete() throws SQLException
* {
* try (PreparedStatement preparedStatement = connection.prepareStatement(
* "DELETE FROM recruit WHERE id=?")) {
* preparedStatement.executeQuery();
* }
* }
*/
}

@ -0,0 +1,80 @@
package com.example.dao;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.example.bean.RecruitBean;
import com.example.utility.Connect;
public class RecruitDAO {
Connect connect = new Connect();
public List<RecruitBean> retrieve(String searchKey) throws SQLException, IOException {
List<RecruitBean> recruitList = new ArrayList<>();
RecruitBean recruitBean = new RecruitBean();
String retrieveByName="SELECT * FROM recruit WHERE name LIKE ?";
String retrieveByContent="SELECT * FROM recruit WHERE content LIKE ? ";
String retrieveByLocation="SELECT * FROM recruit WHERE companyID LIKE ? ";
String retrieveByCompany="SELECT * FROM recruit WHERE companyID LIKE ? ";
try (Connection connection = connect.databaseConnect()) {
try (PreparedStatement preparedStatement = connection
.prepareStatement(retrieveByName)) {
preparedStatement.setObject(1, "%"+searchKey+"%");
try (ResultSet resultSet = preparedStatement.executeQuery()) {
while (resultSet.next()) {
recruitBean.setHits(resultSet.getInt("hits"));
recruitBean.setApplications(resultSet.getInt("applications"));
recruitBean.setName(resultSet.getString("name"));
recruitBean.setContent(resultSet.getString("content"));
recruitBean.setLocation(resultSet.getString("location"));
recruitBean.setSalary(resultSet.getInt("salary"));
recruitList.add(recruitBean);
} //把这里封装成方法来简化
} catch (SQLException e) {
System.out.println(e.getMessage());
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
return recruitList;
}
public void create(String name, String content, String location, int salary, String company,String companyID)
throws SQLException, IOException {
try (Connection connection = connect.databaseConnect()) {
try (PreparedStatement preparedStatement = connection.prepareStatement(
"INSERT INTO recruit (name, content, location, salary, companyID) VALUES (?,?,?,?,?,?)")) {
preparedStatement.setObject(1, name);
preparedStatement.setObject(2, content);
preparedStatement.setObject(3, location);
preparedStatement.setObject(4, salary);
preparedStatement.setObject(5, companyID);
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
}
/*
* public void update() throws SQLException {
* try (PreparedStatement preparedStatement = connection.prepareStatement(
* "UPDATE recruit SET name=? WHERE id=?")) {
* preparedStatement.executeQuery();
* }
* }
*
* public void delete() throws SQLException
* {
* try (PreparedStatement preparedStatement = connection.prepareStatement(
* "DELETE FROM recruit WHERE id=?")) {
* preparedStatement.executeQuery();
* }
* }
*/
}

@ -0,0 +1,80 @@
package com.example.dao;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.example.bean.ApplicationBean;
import com.example.bean.RecruitBean;
import com.example.utility.Connect;
public class ApplicationDAO {
Connect connect = new Connect();
public List<ApplicationBean> retrieve(String searchKey) throws SQLException, IOException {
List<ApplicationBean> ApplicationList = new ArrayList<>();
ApplicationBean applicationBean = new ApplicationBean();
String retrieveByName="SELECT * FROM recruit WHERE name LIKE ?";
String retrieveByContent="SELECT * FROM recruit WHERE content LIKE ? ";
String retrieveByLocation="SELECT * FROM recruit WHERE companyID LIKE ? ";
String retrieveByCompany="SELECT * FROM recruit WHERE companyID LIKE ? ";
try (Connection connection = connect.databaseConnect()) {
try (PreparedStatement preparedStatement = connection
.prepareStatement(retrieveByName)) {
preparedStatement.setObject(1, "%"+searchKey+"%");
try (ResultSet resultSet = preparedStatement.executeQuery()) {
while (resultSet.next()) {
ApplicationBean.setName(resultSet.getInt("name"));
ApplicationBean.setDegrees(resultSet.getInt("degrees"));
ApplicationBean.setMajor(resultSet.getString("major"));
ApplicationBean.setHobby(resultSet.getString("hobby"));
ApplicationBean.setAccountID(resultSet.getString("accountID"));
} //把这里封装成方法来简化
} catch (SQLException e) {
System.out.println(e.getMessage());
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
return ApplicationList;
}
public void create(String name, String content, String location, int salary, String company,String companyID)
throws SQLException, IOException {
try (Connection connection = connect.databaseConnect()) {
try (PreparedStatement preparedStatement = connection.prepareStatement(
"INSERT INTO recruit (name, content, location, salary, companyID) VALUES (?,?,?,?,?,?)")) {
preparedStatement.setObject(1, name);
preparedStatement.setObject(2, content);
preparedStatement.setObject(3, location);
preparedStatement.setObject(4, salary);
preparedStatement.setObject(5, companyID);
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
}
/*
* public void update() throws SQLException {
* try (PreparedStatement preparedStatement = connection.prepareStatement(
* "UPDATE recruit SET name=? WHERE id=?")) {
* preparedStatement.executeQuery();
* }
* }
*
* public void delete() throws SQLException
* {
* try (PreparedStatement preparedStatement = connection.prepareStatement(
* "DELETE FROM recruit WHERE id=?")) {
* preparedStatement.executeQuery();
* }
* }
*/
}

@ -0,0 +1,22 @@
package com.example.servlet;
import java.io.IOException;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/applicationManage")
public class ApplicationManageServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html");
request.getRequestDispatcher("WEB-INF/jsp/applicationManage.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
doGet(request, response);
}
}

@ -0,0 +1,22 @@
package com.example.servlet;
import java.io.IOException;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/logSign")
public class LogSignServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html");
request.getRequestDispatcher("WEB-INF/jsp/logSign.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
doGet(request, response);
}
}

@ -0,0 +1,22 @@
package com.example.servlet;
import java.io.IOException;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/")
public class MainPageServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html");
request.getRequestDispatcher("WEB-INF/jsp/mainPage.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
doGet(request, response);
}
}

@ -0,0 +1,22 @@
package com.example.servlet;
import java.io.IOException;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/manage")
public class ManageServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html");
request.getRequestDispatcher("WEB-INF/jsp/manage.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
doGet(request, response);
}
}

@ -0,0 +1,43 @@
package com.example.servlet;
import java.io.IOException;
import java.sql.SQLException;
import com.alibaba.fastjson.JSONObject;
import com.example.dao.RecruitDAO;
import com.example.utility.HttpGetJson;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/profile")
public class ProfileServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.getRequestDispatcher("WEB-INF/jsp/search.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
request.setCharacterEncoding("UTF-8");//请求编码类型
response.setCharacterEncoding("UTF-8");//响应编码类型
response.setContentType("application/json");//响应数据类型
JSONObject searchKey= HttpGetJson.getJson(request);
if (searchKey!=null){
RecruitDAO recruitDAO=new RecruitDAO();
try{
recruitDAO.retrieve("");
}
catch(SQLException e)
{
System.out.println(e.getMessage());
}
}
JSONObject responseSearch=new JSONObject();//即将返回前端数据
responseSearch.put("code",200); //待补充
response.getWriter().write(String.valueOf(responseSearch));
}
}
//参考文章 https://blog.csdn.net/qq_30315977/article/details/119060325

@ -0,0 +1,43 @@
package com.example.servlet;
import java.io.IOException;
import java.sql.SQLException;
import com.alibaba.fastjson.JSONObject;
import com.example.dao.RecruitDAO;
import com.example.utility.HttpGetJson;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/recruit")
public class RecruitServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.getRequestDispatcher("WEB-INF/jsp/search.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
request.setCharacterEncoding("UTF-8");//请求编码类型
response.setCharacterEncoding("UTF-8");//响应编码类型
response.setContentType("application/json");//响应数据类型
JSONObject searchKey= HttpGetJson.getJson(request);
if (searchKey!=null){
RecruitDAO recruitDAO=new RecruitDAO();
try{
recruitDAO.retrieve("");
}
catch(SQLException e)
{
System.out.println(e.getMessage());
}
}
JSONObject responseSearch=new JSONObject();//即将返回前端数据
responseSearch.put("code",200); //待补充
response.getWriter().write(String.valueOf(responseSearch));
}
}
//参考文章 https://blog.csdn.net/qq_30315977/article/details/119060325

@ -0,0 +1,43 @@
package com.example.servlet;
import java.io.IOException;
import java.sql.SQLException;
import com.alibaba.fastjson.JSONObject;
import com.example.dao.RecruitDAO;
import com.example.utility.HttpGetJson;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/search")
public class SearchServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.getRequestDispatcher("WEB-INF/jsp/search.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
request.setCharacterEncoding("UTF-8");//请求编码类型
response.setCharacterEncoding("UTF-8");//响应编码类型
response.setContentType("application/json");//响应数据类型
JSONObject searchKey= HttpGetJson.getJson(request);
if (searchKey!=null){
RecruitDAO recruitDAO=new RecruitDAO();
try{
recruitDAO.retrieve("");
}
catch(SQLException e)
{
System.out.println(e.getMessage());
}
}
JSONObject responseSearch=new JSONObject();//即将返回前端数据
responseSearch.put("code",200); //待补充
response.getWriter().write(String.valueOf(responseSearch));
}
}
//参考文章 https://blog.csdn.net/qq_30315977/article/details/119060325

@ -0,0 +1,42 @@
package com.example.utility;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
public class Connect {
private Properties properties = new Properties();
private Connection connection;
public Connection databaseConnect() throws IOException {
InputStream inputStream = this.getClass().getResourceAsStream("jdbc.properties");
properties.load(inputStream);
String jdbcUri = properties.getProperty("jdbcUri");
String jdbcUser = properties.getProperty("jdbcUser");
String jdbcPassword = properties.getProperty("jdbcPassword");
try {
Class.forName("com.mysql.cj.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}
try {
connection = DriverManager.getConnection(jdbcUri, jdbcUser, jdbcPassword);
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return connection;
}
/*public int databaseClose() {
try {
connection.close();
} catch (SQLException e) {
return -1;
}
return 0;
}*/
}

@ -0,0 +1,34 @@
package com.example.utility;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import com.alibaba.fastjson.JSONObject;
import jakarta.servlet.http.HttpServletRequest;
public class HttpGetJson {
public static JSONObject getJson(HttpServletRequest request) {
String result = "";
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(
request.getInputStream(), "utf-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (IOException e) {
System.out.println(e.getMessage());
} finally {
try {
in.close();
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
return (JSONObject) JSONObject.parse(result);
}
}

@ -0,0 +1,3 @@
jdbcUri=jdbc:mysql://localhost:3306/recruit?useSSL=false&characterEncoding=utf8
jdbcUser=root
jdbcPassword=12345678

@ -0,0 +1,28 @@
function createXMLHttpRequest() {
let xmlHttpRequest = new XMLHttpRequest();
if (window.XMLHttpRequest) { // 非IE浏览器
xmlHttpRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE浏览器
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlHttpRequest;
}
function jsonSend() {
let searchKey=JSON.stringify({searchkey:document.getElementById("searchBox").value});
let xmlHttpRequest = createXMLHttpRequest();
xmlHttpRequest.open("POST", "https://localhost:8080/search", true);
xmlHttpRequest.setRequestHeader("Content-Type", "application/json");
xmlHttpRequest.onreadystatechange = function() {
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
if (xmlHttpRequest.status === 200) {
let responseData = xmlHttpRequest.responseText;
} else {
console.error('Server response error:', xmlHttpRequest.statusText);
}
}
};
xmlHttpRequest.send(seachKey);
}
//参考文章 https://blog.csdn.net/weixin_34718952/article/details/148485765

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>application details</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is application details page</h1>
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>application manage</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is application manage page</h1>
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>entreprise profile</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is entreprise profile page</h1>
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>logSign</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is logSign page</h1>
</body>
</html>

@ -0,0 +1,23 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true" %>
<html>
<head>
<title>mainPage</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is main page</h1>
<a href="http://localhost:8080/recruit/logSign">log/sign up</a>
<br>
<a href="http://localhost:8080/recruit/search">search</a>
<br>
<a href="http://localhost:8080/recruit/applicationManage">applicationManage</a>
<br>
<a href="http://localhost:8080/recruit/profile">profile</a>
<br>
<a href="http://localhost:8080/recruit/manage">manage</a>
<!--待验证权限-->
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>manager to use</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is manager to use page</h1>
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>logSign</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is logSign page</h1>
</body>
</html>

@ -0,0 +1,20 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>search</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="js/search.js"></script>
</head>
<body>
<h1>this is search page</h1>
<div>
<form>
<lable for="searchBox">search:</lable>
<input type="text" id="searchBox" name="searchBox">
<input type="button" value="confirm" onclick="jsonSearch()">
</form>
</div>
</body>
</html>

@ -0,0 +1,12 @@
<a%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"%>
<html>
<head>
<title>student profile</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>this is student profile page</h1>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save