Compare commits
No commits in common. 'main' and 'd_branch' have entirely different histories.
@ -1 +0,0 @@
|
||||
Subproject commit 495661ee0f0688985eec8f3c1099260d0e6558ec
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"java.configuration.updateBuildConfiguration": "automatic"
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
<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>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.19.0</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>
|
||||
@ -1,63 +0,0 @@
|
||||
package com.example.bean;
|
||||
|
||||
public class LogSignBean {
|
||||
private int id;
|
||||
|
||||
private String account;
|
||||
|
||||
private String password;
|
||||
|
||||
private int status; //0 offline, 1 online
|
||||
|
||||
private String authorization;
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getAccount()
|
||||
{
|
||||
return account;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public int getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getAuthorization()
|
||||
{
|
||||
return authorization;
|
||||
}
|
||||
|
||||
public void setId(int id)
|
||||
{
|
||||
this.id=id;
|
||||
}
|
||||
|
||||
public void setAccount(String account)
|
||||
{
|
||||
this.account=account;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password=password;
|
||||
}
|
||||
|
||||
public void setStatus(int status)
|
||||
{
|
||||
this.status=status;
|
||||
}
|
||||
|
||||
public void setAuthorization(String authorization)
|
||||
{
|
||||
this.authorization=authorization;
|
||||
}
|
||||
}
|
||||
@ -1,93 +0,0 @@
|
||||
package com.example.bean;
|
||||
|
||||
public class RecruitBean {
|
||||
private int hits;
|
||||
|
||||
private String name;
|
||||
|
||||
private String content;
|
||||
|
||||
private String location;
|
||||
|
||||
private int salary;
|
||||
|
||||
private String company;
|
||||
|
||||
private String companyID;
|
||||
|
||||
private String contactEmail;
|
||||
|
||||
private int id;
|
||||
|
||||
public int getHits() {
|
||||
return hits;
|
||||
}
|
||||
|
||||
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 int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getContactEmail() {
|
||||
return contactEmail;
|
||||
}
|
||||
|
||||
public void setHits(int hits) {
|
||||
this.hits = hits;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setContactEmail(String contactEmail) {
|
||||
this.contactEmail = contactEmail;
|
||||
}
|
||||
}
|
||||
@ -1,144 +0,0 @@
|
||||
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.LogSignBean;
|
||||
import com.example.utility.Connect;
|
||||
import com.example.utility.SaltMD5Util;
|
||||
|
||||
public class LogSignDAO {
|
||||
Connect connect = new Connect();
|
||||
|
||||
public LogSignBean retrieveById(int id) throws SQLException, IOException {
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"SELECT * EXCEPT (password) FROM accountTable WHICH id = ? ")) {
|
||||
preparedStatement.setObject(1, id);
|
||||
ResultSet resultSet = preparedStatement.executeQuery();
|
||||
if (resultSet.next()) {
|
||||
LogSignBean logSignBean = new LogSignBean();
|
||||
logSignBean.setId(resultSet.getInt("id"));
|
||||
logSignBean.setAccount(resultSet.getString("account"));
|
||||
logSignBean.setStatus(resultSet.getInt("status"));
|
||||
logSignBean.setAuthorization(resultSet.getString("authorization"));
|
||||
return logSignBean;
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean logIn(String account, String password) throws SQLException, IOException {
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"SELECT password FROM accounttable WHERE account=?")) {
|
||||
preparedStatement.setObject(1, account);
|
||||
ResultSet resultSet = preparedStatement.executeQuery();
|
||||
if (resultSet.next())
|
||||
return SaltMD5Util.verifySaltPassword(password, resultSet.getString("password"));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LogSignBean getBean(String account) throws SQLException, IOException {
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"SELECT * FROM accounttable WHERE account=?")) {
|
||||
preparedStatement.setObject(1, account);
|
||||
ResultSet resultSet = preparedStatement.executeQuery();
|
||||
if (resultSet.next()) {
|
||||
LogSignBean logSignBean = new LogSignBean();
|
||||
logSignBean.setAccount(resultSet.getString("account"));
|
||||
logSignBean.setAuthorization(resultSet.getString("authorization"));
|
||||
logSignBean.setId(resultSet.getInt("id"));
|
||||
logSignBean.setStatus(resultSet.getInt("status"));
|
||||
return logSignBean;
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void signUp(String account, String password, String authorization) throws SQLException, IOException {
|
||||
String passwordMD5 = SaltMD5Util.generateSaltPassword(password);
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"INSERT INTO accounttable (account, password, authorization) VALUES (?,?,?)")) {
|
||||
preparedStatement.setObject(1, account);
|
||||
preparedStatement.setObject(2, passwordMD5);
|
||||
preparedStatement.setObject(3, authorization);
|
||||
preparedStatement.executeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateStatus(int status, int id) throws SQLException, IOException {
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"UPDATE accounttable SET status=? WHERE id=?")) {
|
||||
preparedStatement.setObject(1, status);
|
||||
preparedStatement.setObject(2, id);
|
||||
preparedStatement.executeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<LogSignBean> retrieveAll() throws SQLException, IOException {
|
||||
List<LogSignBean> logSignList = new ArrayList<>();
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"SELECT * FROM accountTable")) {
|
||||
try (ResultSet resultSet = preparedStatement.executeQuery()) {
|
||||
while (resultSet.next()) {
|
||||
LogSignBean logSignBean = new LogSignBean();
|
||||
logSignBean.setId(resultSet.getInt("id"));
|
||||
logSignBean.setAccount(resultSet.getString("account"));
|
||||
logSignBean.setStatus(resultSet.getInt("status"));
|
||||
logSignBean.setAuthorization(resultSet.getString("authorization"));
|
||||
logSignList.add(logSignBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return logSignList;
|
||||
}
|
||||
|
||||
public void deleteById(int id) throws SQLException, IOException {
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"DELETE FROM accountTable WHERE id=?")) {
|
||||
preparedStatement.setObject(1, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteByAccount(String account) throws SQLException, IOException {
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"DELETE FROM accountTable WHERE account=?")) {
|
||||
preparedStatement.setObject(1, account);
|
||||
preparedStatement.executeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updatePassword(String newPassword, int id) throws SQLException, IOException {
|
||||
String passwordMD5 = SaltMD5Util.generateSaltPassword(newPassword);
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"UPDATE accountTable SET password = ? WHERE id=?")) {
|
||||
preparedStatement.setObject(1, passwordMD5);
|
||||
preparedStatement.setObject(2, id);
|
||||
preparedStatement.executeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,205 +0,0 @@
|
||||
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 RecruitBean retrieve(int id) throws SQLException, IOException {
|
||||
RecruitBean recruitBean = new RecruitBean();
|
||||
String sql = "SELECT * FROM recruit WHERE id=?";
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection
|
||||
.prepareStatement(sql)) {
|
||||
preparedStatement.setObject(1, id);
|
||||
try (ResultSet resultSet = preparedStatement.executeQuery()) {
|
||||
if (resultSet.next()) {
|
||||
recruitBean.setHits(resultSet.getInt("hits"));
|
||||
recruitBean.setName(resultSet.getString("name"));
|
||||
recruitBean.setContent(resultSet.getString("content"));
|
||||
recruitBean.setLocation(resultSet.getString("location"));
|
||||
recruitBean.setSalary(resultSet.getInt("salary"));
|
||||
recruitBean.setId(resultSet.getInt("id"));
|
||||
recruitBean.setCompany(resultSet.getString("company"));
|
||||
recruitBean.setCompanyID(resultSet.getString("companyID"));
|
||||
recruitBean.setContactEmail(resultSet.getString("contactEmail"));
|
||||
} else
|
||||
return null;
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return recruitBean;
|
||||
}
|
||||
|
||||
public List<RecruitBean> retrieveKey(String searchKey) throws SQLException, IOException {
|
||||
List<RecruitBean> recruitList = new ArrayList<>();
|
||||
String retrieveByName = "SELECT * FROM recruit WHERE name LIKE ?";
|
||||
String retrieveByContent = "SELECT * FROM recruit WHERE content LIKE ? ";
|
||||
String retrieveByLocation = "SELECT * FROM recruit WHERE location LIKE ? ";
|
||||
String retrieveByCompany = "SELECT * FROM recruit WHERE company LIKE ? ";
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
singleSqlRetrieve(retrieveByName, connection, searchKey, recruitList);
|
||||
singleSqlRetrieve(retrieveByContent, connection, searchKey, recruitList);
|
||||
singleSqlRetrieve(retrieveByLocation, connection, searchKey, recruitList);
|
||||
singleSqlRetrieve(retrieveByCompany, connection, searchKey, recruitList);
|
||||
}
|
||||
return recruitList;
|
||||
}
|
||||
|
||||
private List<RecruitBean> singleSqlRetrieve(String sql, Connection connection, String searchKey,
|
||||
List<RecruitBean> recruitList) {
|
||||
try (PreparedStatement preparedStatement = connection
|
||||
.prepareStatement(sql)) {
|
||||
preparedStatement.setObject(1, "%" + searchKey + "%");
|
||||
try (ResultSet resultSet = preparedStatement.executeQuery()) {
|
||||
while (resultSet.next()) {
|
||||
if (isRepeated(resultSet.getInt("id"), recruitList) == false) {
|
||||
RecruitBean recruitBean = new RecruitBean();
|
||||
recruitBean.setHits(resultSet.getInt("hits"));
|
||||
recruitBean.setName(resultSet.getString("name"));
|
||||
recruitBean.setContent(resultSet.getString("content"));
|
||||
recruitBean.setLocation(resultSet.getString("location"));
|
||||
recruitBean.setSalary(resultSet.getInt("salary"));
|
||||
recruitBean.setId(resultSet.getInt("id"));
|
||||
recruitBean.setCompany(resultSet.getString("company"));
|
||||
recruitBean.setCompanyID(resultSet.getString("companyID"));
|
||||
recruitBean.setContactEmail(resultSet.getString("contactEmail"));
|
||||
recruitList.add(recruitBean);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return recruitList;
|
||||
}
|
||||
|
||||
public void create(String name, String content, String location, int salary, String company, String companyID,
|
||||
String contactEmail)
|
||||
throws SQLException, IOException {
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"INSERT INTO recruit (name, content, location, salary, company, companyID, contactEmail) VALUES (?,?,?,?,?,?,?)")) {
|
||||
preparedStatement.setObject(1, name);
|
||||
preparedStatement.setObject(2, content);
|
||||
preparedStatement.setObject(3, location);
|
||||
preparedStatement.setObject(4, salary);
|
||||
preparedStatement.setObject(5, company);
|
||||
preparedStatement.setObject(6, companyID);
|
||||
preparedStatement.setObject(7, contactEmail);
|
||||
preparedStatement.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void hitsAdd(int hits, int id) throws SQLException, IOException {
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"UPDATE recruit SET hits=? WHERE id=?")) {
|
||||
preparedStatement.setObject(1, hits);
|
||||
preparedStatement.setObject(2, id);
|
||||
preparedStatement.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isRepeated(int id, List<RecruitBean> recruitList) {
|
||||
for (RecruitBean item : recruitList) {
|
||||
if (item.getId() == id)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<RecruitBean> retrieveAll() throws SQLException, IOException {
|
||||
List<RecruitBean> recruitList = new ArrayList<>();
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"SELECT id, name, company, companyID FROM recruit")) {
|
||||
try (ResultSet resultSet = preparedStatement.executeQuery()) {
|
||||
while (resultSet.next()) {
|
||||
RecruitBean recruitBean = new RecruitBean();
|
||||
recruitBean.setId(resultSet.getInt("id"));
|
||||
recruitBean.setName(resultSet.getString("name"));
|
||||
recruitBean.setCompany(resultSet.getString("company"));
|
||||
recruitBean.setCompanyID(resultSet.getString("companyID"));
|
||||
recruitList.add(recruitBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return recruitList;
|
||||
}
|
||||
|
||||
public List<RecruitBean> retrieveByAccount(String account) throws SQLException, IOException {
|
||||
List<RecruitBean> recruitList = new ArrayList<>();
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"SELECT id, name, company FROM recruit WHERE companyID = ?")) {
|
||||
preparedStatement.setObject(1, account);
|
||||
ResultSet resultSet = preparedStatement.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
RecruitBean recruitBean = new RecruitBean();
|
||||
recruitBean.setId(resultSet.getInt("id"));
|
||||
recruitBean.setName(resultSet.getString("name"));
|
||||
recruitBean.setCompany(resultSet.getString("company"));
|
||||
recruitList.add(recruitBean);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return recruitList;
|
||||
}
|
||||
}
|
||||
|
||||
public List<RecruitBean> retrieveForRecommand() throws SQLException, IOException {
|
||||
List<RecruitBean> recruitList = new ArrayList<>();
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"SELECT * FROM recruit")) {
|
||||
try (ResultSet resultSet = preparedStatement.executeQuery()) {
|
||||
while (resultSet.next()) {
|
||||
RecruitBean recruitBean = new RecruitBean();
|
||||
recruitBean.setId(resultSet.getInt("id"));
|
||||
recruitBean.setHits(resultSet.getInt("hits"));
|
||||
recruitBean.setLocation(resultSet.getString("location"));
|
||||
recruitBean.setSalary(resultSet.getInt("salary"));
|
||||
recruitBean.setName(resultSet.getString("name"));
|
||||
recruitBean.setCompany(resultSet.getString("company"));
|
||||
recruitList.add(recruitBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return recruitList;
|
||||
}
|
||||
|
||||
public void deleteById(int id) throws SQLException, IOException {
|
||||
try (Connection connection = connect.databaseConnect()) {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(
|
||||
"DELETE FROM recruit WHERE id=?")) {
|
||||
preparedStatement.setObject(1, id);
|
||||
preparedStatement.executeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
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("/entrepriseManage")
|
||||
public class EntrepriseManage 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);
|
||||
}
|
||||
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||
doGet(request, response);
|
||||
}
|
||||
}
|
||||
@ -1,103 +0,0 @@
|
||||
package com.example.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.example.bean.LogSignBean;
|
||||
import com.example.dao.LogSignDAO;
|
||||
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;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
@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;charset=utf-8");
|
||||
request.getRequestDispatcher("WEB-INF/jsp/logSign.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;charset=utf-8");
|
||||
HttpSession session = request.getSession();
|
||||
JSONObject status = new JSONObject();
|
||||
LogSignDAO logSignDAO = new LogSignDAO();
|
||||
JSONObject logSignJson = HttpGetJson.getJson(request);
|
||||
if (logSignJson.getString("method") != null) {
|
||||
if (logSignJson.getString("method").equals("delete")) {
|
||||
try {
|
||||
logSignDAO.deleteByAccount(logSignJson.getString("account"));
|
||||
status.put("status", "删除成功");
|
||||
} catch (SQLException e) {
|
||||
status.put("status", "删除失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
response.getWriter().write(String.valueOf(status));
|
||||
}
|
||||
} else {
|
||||
if (logSignJson.getString("newPassword") != null) { // 修改密码
|
||||
try {
|
||||
logSignDAO.updatePassword(logSignJson.getString("newPassword"),
|
||||
Integer.parseInt(session.getAttribute("accountID").toString()));
|
||||
status.put("status", "修改成功");
|
||||
} catch (SQLException e) {
|
||||
status.put("status", "修改失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
response.getWriter().write(String.valueOf(status));
|
||||
} else {
|
||||
if ("0".equals(logSignJson.getString("status"))) { // 账号状态处理
|
||||
session.setAttribute("accountAuthorization", null);
|
||||
session.setAttribute("accountStatus", 0);
|
||||
try {
|
||||
logSignDAO.updateStatus(0, Integer.parseInt(session.getAttribute("accountID").toString()));
|
||||
session.setAttribute("accountID", null);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
if (logSignJson.getString("authorization") == null) { // 登录
|
||||
try {
|
||||
Boolean boolean1 = logSignDAO.logIn(logSignJson.getString("account"),
|
||||
logSignJson.getString("password"));
|
||||
if (boolean1 == true) {
|
||||
status.put("status", "登录成功");
|
||||
session.setAttribute("accountStatus", 1);
|
||||
LogSignBean logSignBean = new LogSignBean();
|
||||
logSignBean = logSignDAO.getBean(logSignJson.getString("account"));
|
||||
session.setAttribute("accountAuthorization", logSignBean.getAuthorization());
|
||||
session.setAttribute("accountID", logSignBean.getId()); // 主键
|
||||
session.setAttribute("account", logSignBean.getAccount()); // 账号
|
||||
logSignDAO.updateStatus(1,
|
||||
Integer.parseInt(session.getAttribute("accountID").toString()));
|
||||
} else
|
||||
status.put("status", "登录失败");
|
||||
} catch (SQLException e) {
|
||||
status.put("status", "登录失败");
|
||||
}
|
||||
} else { // 注册
|
||||
try {
|
||||
logSignDAO.signUp(logSignJson.getString("account"), logSignJson.getString("password"),
|
||||
logSignJson.getString("authorization"));
|
||||
status.put("status", "注册成功");
|
||||
} catch (SQLException e) {
|
||||
status.put("status", "注册失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
response.getWriter().write(String.valueOf(status));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 由于没有设置操作字段导致的屎山
|
||||
@ -1,59 +0,0 @@
|
||||
package com.example.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.example.bean.RecruitBean;
|
||||
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("/main")
|
||||
public class MainPageServlet extends HttpServlet {
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||
request.setCharacterEncoding("utf-8");
|
||||
request.getRequestDispatcher("WEB-INF/jsp/mainPage.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");// 响应数据类型
|
||||
List<RecruitBean> searchResult = new ArrayList<>();
|
||||
JSONObject searchJson = HttpGetJson.getJson(request);
|
||||
String searchKey = searchJson.getString("searchKey");
|
||||
if (searchKey != null) {
|
||||
RecruitDAO recruitDAO = new RecruitDAO();
|
||||
try {
|
||||
searchResult = recruitDAO.retrieveKey(searchKey);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
JSONArray itemArray = new JSONArray();
|
||||
for (RecruitBean bean : searchResult) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("name", bean.getName());
|
||||
item.put("content", bean.getContent());
|
||||
item.put("location", bean.getLocation());
|
||||
item.put("salary", bean.getSalary());
|
||||
item.put("company", bean.getCompany());
|
||||
item.put("companyID", bean.getCompanyID());
|
||||
item.put("id", bean.getId());
|
||||
itemArray.add(item);
|
||||
}
|
||||
response.getWriter().write(String.valueOf(itemArray));
|
||||
}
|
||||
}
|
||||
|
||||
//优化 1.必须先点击资料页才能在创建新招聘项时使用默认值
|
||||
// 2.需要手动刷新来更新session属性
|
||||
@ -1,76 +0,0 @@
|
||||
package com.example.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.example.bean.LogSignBean;
|
||||
import com.example.bean.RecruitBean;
|
||||
import com.example.dao.LogSignDAO;
|
||||
import com.example.dao.RecruitDAO;
|
||||
|
||||
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 {
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/json;charset=utf-8");
|
||||
LogSignDAO logSignDAO = new LogSignDAO();
|
||||
List<LogSignBean> logSignList = new ArrayList<>();
|
||||
List<RecruitBean> recruitList = new ArrayList<>();
|
||||
try {
|
||||
logSignList = logSignDAO.retrieveAll();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
RecruitDAO recruitDAO = new RecruitDAO();
|
||||
try {
|
||||
recruitList = recruitDAO.retrieveAll();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject allObject = new JSONObject();
|
||||
if (logSignList != null) {
|
||||
JSONArray accountArray = new JSONArray();
|
||||
for (LogSignBean bean : logSignList) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("account", bean.getAccount());
|
||||
item.put("status", bean.getStatus());
|
||||
item.put("authorization", bean.getAuthorization());
|
||||
item.put("id", bean.getId());
|
||||
accountArray.add(item);
|
||||
}
|
||||
allObject.put("accountJson", accountArray);
|
||||
} else
|
||||
allObject.put("accountJson", null);
|
||||
if (logSignList != null) {
|
||||
JSONArray recruitArray = new JSONArray();
|
||||
for (RecruitBean bean : recruitList) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("name", bean.getName());
|
||||
item.put("company", bean.getCompany());
|
||||
item.put("companyID", bean.getCompanyID());
|
||||
item.put("id", bean.getId());
|
||||
recruitArray.add(item);
|
||||
}
|
||||
allObject.put("recruitJson", recruitArray);
|
||||
} else
|
||||
allObject.put("recruitJson", null);
|
||||
response.getWriter().write(String.valueOf(allObject));
|
||||
}
|
||||
}
|
||||
@ -1,131 +0,0 @@
|
||||
package com.example.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.example.bean.RecruitBean;
|
||||
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;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
@WebServlet("/details")
|
||||
public class RecruitServlet extends HttpServlet {
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException {
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
HttpSession session = request.getSession();
|
||||
if (request.getParameter("id") != null) {
|
||||
session.setAttribute("recruitPageStatus", "show");
|
||||
int id = Integer.parseInt(request.getParameter("id"));
|
||||
RecruitDAO recruitDAO = new RecruitDAO();
|
||||
RecruitBean recruitBean = null;
|
||||
try {
|
||||
recruitBean = recruitDAO.retrieve(id);
|
||||
recruitDAO.hitsAdd(recruitBean.getHits() + 1, recruitBean.getId());
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
request.setAttribute("recruitBean", recruitBean);
|
||||
} else {
|
||||
session.setAttribute("recruitPageStatus", "new");
|
||||
}
|
||||
request.getRequestDispatcher("/WEB-INF/jsp/recruitDetails.jsp").forward(request, response);
|
||||
}
|
||||
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
request.setCharacterEncoding("UTF-8");// 请求编码类型
|
||||
response.setCharacterEncoding("UTF-8");// 响应编码类型
|
||||
response.setContentType("application/json");// 响应数据类型
|
||||
HttpSession session = request.getSession();
|
||||
session.setAttribute("recruitPageStatus", "new");
|
||||
RecruitDAO recruitDAO = new RecruitDAO();
|
||||
JSONObject status = new JSONObject();
|
||||
JSONObject newJson = HttpGetJson.getJson(request);
|
||||
if (newJson.getString("method") != null) {
|
||||
if (newJson.getString("method").equals("delete")) {
|
||||
try {
|
||||
recruitDAO.deleteById(Integer.parseInt(newJson.getString("id")));
|
||||
status.put("status", "删除成功");
|
||||
} catch (SQLException e) {
|
||||
status.put("status", "删除失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (newJson.getString("method").equals("entrepriseManage")) {
|
||||
try {
|
||||
List<RecruitBean> resultList = new ArrayList<>();
|
||||
resultList = recruitDAO.retrieveByAccount(newJson.getString("account"));
|
||||
if (resultList != null) {
|
||||
JSONArray resultJson = new JSONArray();
|
||||
for (RecruitBean bean : resultList) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("name", bean.getName());
|
||||
item.put("id", bean.getId());
|
||||
item.put("company", bean.getCompany());
|
||||
resultJson.add(item);
|
||||
}
|
||||
response.getWriter().write(String.valueOf(resultJson));
|
||||
} else {
|
||||
response.getWriter().write(String.valueOf(null));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (newJson.getString("method").equals("recommand")) {
|
||||
try {
|
||||
List<RecruitBean> resultList = new ArrayList<>();
|
||||
resultList = recruitDAO.retrieveForRecommand();
|
||||
if (resultList != null) {
|
||||
Collections.sort(resultList, Comparator.comparing(RecruitBean::getHits).reversed());
|
||||
JSONArray resultJson = new JSONArray();
|
||||
for (int i = 0; i < 6; i++) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("name", resultList.get(i).getName());
|
||||
item.put("id", resultList.get(i).getId());
|
||||
item.put("location", resultList.get(i).getLocation());
|
||||
item.put("salary", resultList.get(i).getSalary());
|
||||
item.put("company", resultList.get(i).getCompany());
|
||||
resultJson.add(item);
|
||||
}
|
||||
response.getWriter().write(String.valueOf(resultJson));
|
||||
} else {
|
||||
response.getWriter().write(String.valueOf(null));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
String name = newJson.getString("name");
|
||||
String content = newJson.getString("content");
|
||||
String location = newJson.getString("location");
|
||||
int salary = newJson.getIntValue("salary");
|
||||
String company = newJson.getString("company");
|
||||
String companyID = newJson.getString("companyID");
|
||||
String contactEmail = newJson.getString("contactEmail");
|
||||
try {
|
||||
recruitDAO.create(name, content, location, salary, company, companyID, contactEmail);
|
||||
status.put("status", "创建成功");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
status.put("status", "创建失败");
|
||||
}
|
||||
}
|
||||
response.getWriter().write(String.valueOf(status));
|
||||
}
|
||||
}
|
||||
@ -1,58 +0,0 @@
|
||||
package com.example.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.example.bean.RecruitBean;
|
||||
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 {
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
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");// 响应数据类型
|
||||
List<RecruitBean> searchResult = new ArrayList<>();
|
||||
JSONObject searchJson = HttpGetJson.getJson(request);
|
||||
String searchKey = searchJson.getString("searchKey");
|
||||
if (searchKey != null) {
|
||||
RecruitDAO recruitDAO = new RecruitDAO();
|
||||
try {
|
||||
searchResult = recruitDAO.retrieveKey(searchKey);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
JSONArray itemArray = new JSONArray();
|
||||
for (RecruitBean bean : searchResult) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("name", bean.getName());
|
||||
item.put("content", bean.getContent());
|
||||
item.put("location", bean.getLocation());
|
||||
item.put("salary", bean.getSalary());
|
||||
item.put("company", bean.getCompany());
|
||||
item.put("companyID", bean.getCompanyID());
|
||||
item.put("id", bean.getId());
|
||||
itemArray.add(item);
|
||||
}
|
||||
response.getWriter().write(String.valueOf(itemArray));
|
||||
}
|
||||
}
|
||||
|
||||
// 参考文章 https://blog.csdn.net/qq_30315977/article/details/119060325
|
||||
@ -1,91 +0,0 @@
|
||||
<div%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>logSign</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script>
|
||||
function logSignSwitch() {
|
||||
document.getElementById("log").style.display = "none";
|
||||
document.getElementById("sign").style.display = "block";
|
||||
}
|
||||
window.onload = function () {
|
||||
const account = '<%=session.getAttribute("account")%>';
|
||||
const accountID = '<%=session.getAttribute("accountID")%>';
|
||||
const accountAuthorization = '<%=session.getAttribute("accountAuthorization")%>';
|
||||
const accountStatus = '<%=session.getAttribute("accountStatus")%>';
|
||||
const studentProfileBean = '<%=session.getAttribute("studentProfileBean")%>';
|
||||
const isStudentProfileExisted = '<%=session.getAttribute("isStudentProfileExisted")%>';
|
||||
const entrepriseProfileBean = '<%=session.getAttribute("entrepriseProfileBean")%>';
|
||||
const isEntrepriseProfileExisted = '<%=session.getAttribute("isEntrepriseProfileExisted")%>';
|
||||
const companyName = '<%=session.getAttribute("companyName")%>';
|
||||
const contactEmail = '<%=session.getAttribute("contactEmail")%>';
|
||||
const recruitPageStatus = '<%=session.getAttribute("recruitPageStatus")%>';
|
||||
console.log("account " + account);
|
||||
console.log("accountID " + accountID);
|
||||
console.log("accountAuthorization " + accountAuthorization);
|
||||
console.log("accountStatus " + accountStatus);
|
||||
console.log("studentProfileBean " + studentProfileBean);
|
||||
console.log("isStudentProfileExisted " + isStudentProfileExisted);
|
||||
console.log("entrepriseProfileBean " + entrepriseProfileBean);
|
||||
console.log("isEntrepriseProfileExisted " + isEntrepriseProfileExisted);
|
||||
console.log("companyName " + companyName);
|
||||
console.log("contactEmail " + contactEmail);
|
||||
console.log("recruitPageStatus " + recruitPageStatus);
|
||||
if (accountAuthorization != 'null' && accountStatus == "1") {
|
||||
document.getElementById("log").style.display = "none";
|
||||
document.getElementById("logged").style.display = "block";
|
||||
document.getElementById("accountLogged").innerText = account;
|
||||
document.getElementById("authorizationLogged").innerText = accountAuthorization;
|
||||
}
|
||||
else
|
||||
document.getElementById("log").style.display = "block";
|
||||
}
|
||||
</script>
|
||||
<script src="/recruit/js/logSign.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="log" style="display:none">
|
||||
<form>
|
||||
<label for="accountLog">用户名:</lable>
|
||||
<input type="text" id="accountLog" autocomplete="off">
|
||||
<br>
|
||||
<label for="passwordLog">密码:</lable>
|
||||
<input type="password" id="passwordLog" autocomplete="off">
|
||||
<br>
|
||||
<input type="button" id="submitLog" value="登录" onclick="logSend()">
|
||||
</form>
|
||||
<input type="button" id="switch" value="注册" onclick="logSignSwitch()">
|
||||
</div><!--这是登录的部分-->
|
||||
<div id="sign" style="display:none">
|
||||
<form>
|
||||
<label for="accountSign">用户名:</lable>
|
||||
<input type="text" id="accountSign" autocomplete="off">
|
||||
<label for="passwordSign">密码:</lable>
|
||||
<input type="password" id="passwordSign" autocomplete="off">
|
||||
账户类型:
|
||||
<input type="radio" name="authorization" value="student">学生
|
||||
<input type="radio" name="authorization" value="entreprise">企业
|
||||
<input type="button" id="submitSign" value="确认" onclick="signSend()">
|
||||
</form>
|
||||
</div><!--这是注册的部分-->
|
||||
<div id="logged" style="display: none">
|
||||
<p>你已登录</p>
|
||||
<p>账号:</p>
|
||||
<p id="accountLogged"></p>
|
||||
<p>身份:</p>
|
||||
<p id="authorizationLogged"></p><br>
|
||||
<input type="button" id="modifyPasswordButton" value="修改密码" onclick="switchModifyBetweenLogged()">
|
||||
<input type="button" id="deregistration" value="退出" onclick="deregistration()">
|
||||
</div><!--这是已登录后显示的账号信息部分-->
|
||||
<div id="modify" style="display: none">
|
||||
<label for="passwordModifyBox">新密码:</lable><input type="text" id="passwordModifyBox" autocomplete="off">
|
||||
<input type="button" value="确认" onclick="modifyPassword()">
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -1,64 +0,0 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>mainPage</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="/recruit/js/mainPage.js"></script>
|
||||
<script>
|
||||
const account = '<%=session.getAttribute("account")%>';
|
||||
const accountID = '<%=session.getAttribute("accountID")%>';
|
||||
const accountAuthorization = '<%=session.getAttribute("accountAuthorization")%>';
|
||||
const accountStatus = '<%=session.getAttribute("accountStatus")%>';
|
||||
const studentProfileBean = '<%=session.getAttribute("studentProfileBean")%>';
|
||||
const isStudentProfileExisted = '<%=session.getAttribute("isStudentProfileExisted")%>';
|
||||
const entrepriseProfileBean = '<%=session.getAttribute("entrepriseProfileBean")%>';
|
||||
const isEntrepriseProfileExisted = '<%=session.getAttribute("isEntrepriseProfileExisted")%>';
|
||||
const companyName = '<%=session.getAttribute("companyName")%>';
|
||||
const contactEmail = '<%=session.getAttribute("contactEmail")%>';
|
||||
const recruitPageStatus = '<%=session.getAttribute("recruitPageStatus")%>';
|
||||
const objectAccount = '<%=session.getAttribute("objectAccount")%>';
|
||||
console.log("account " + account);
|
||||
console.log("accountID " + accountID);
|
||||
console.log("accountAuthorization " + accountAuthorization);
|
||||
console.log("accountStatus " + accountStatus);
|
||||
console.log("studentProfileBean " + studentProfileBean);
|
||||
console.log("isStudentProfileExisted " + isStudentProfileExisted);
|
||||
console.log("entrepriseProfileBean " + entrepriseProfileBean);
|
||||
console.log("isEntrepriseProfileExisted " + isEntrepriseProfileExisted);
|
||||
console.log("companyName " + companyName);
|
||||
console.log("contactEmail " + contactEmail);
|
||||
console.log("recruitPageStatus " + recruitPageStatus);
|
||||
console.log("objectAccount " + objectAccount);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<input type="text" id="hiddenAccountStatus" style="display: none" value="<%=session.getAttribute("accountStatus")%>">
|
||||
<input type="text" id="hiddenAccountAuthorization" style="display: none" value="<%=session.getAttribute("accountAuthorization")%>">
|
||||
<a href="/recruit/logSign">登录/注册</a>
|
||||
<br>
|
||||
<a href="/recruit/search">搜索</a>
|
||||
<br>
|
||||
<a href="/recruit/profile" id="profileAccess">账户资料</a>
|
||||
<a href="/recruit/manage" id="manageAccess" style="display:none">管理</a>
|
||||
<a href="/recruit/entrepriseManage" id="entrepriseManageAccess" style="display:none">发布招聘项管理</a>
|
||||
<h2>当前热门</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>岗位</th>
|
||||
<th>地区</th>
|
||||
<th>工资</th>
|
||||
<th>公司</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="recruitTable">
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -1,70 +0,0 @@
|
||||
<%@ 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">
|
||||
<script src="/recruit/js/manage.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
const account = '<%=session.getAttribute("account")%>';
|
||||
const accountID = '<%=session.getAttribute("accountID")%>';
|
||||
const accountAuthorization = '<%=session.getAttribute("accountAuthorization")%>';
|
||||
const accountStatus = '<%=session.getAttribute("accountStatus")%>';
|
||||
const studentProfileBean = '<%=session.getAttribute("studentProfileBean")%>';
|
||||
const isStudentProfileExisted = '<%=session.getAttribute("isStudentProfileExisted")%>';
|
||||
const entrepriseProfileBean = '<%=session.getAttribute("entrepriseProfileBean")%>';
|
||||
const isEntrepriseProfileExisted = '<%=session.getAttribute("isEntrepriseProfileExisted")%>';
|
||||
const companyName = '<%=session.getAttribute("companyName")%>';
|
||||
const contactEmail = '<%=session.getAttribute("contactEmail")%>';
|
||||
const recruitPageStatus = '<%=session.getAttribute("recruitPageStatus")%>';
|
||||
console.log("account " + account);
|
||||
console.log("accountID " + accountID);
|
||||
console.log("accountAuthorization " + accountAuthorization);
|
||||
console.log("accountStatus " + accountStatus);
|
||||
console.log("studentProfileBean " + studentProfileBean);
|
||||
console.log("isStudentProfileExisted " + isStudentProfileExisted);
|
||||
console.log("entrepriseProfileBean " + entrepriseProfileBean);
|
||||
console.log("isEntrepriseProfileExisted " + isEntrepriseProfileExisted);
|
||||
console.log("companyName " + companyName);
|
||||
console.log("contactEmail " + contactEmail);
|
||||
console.log("recruitPageStatus " + recruitPageStatus);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<input type="button" id="trigger" value="查询信息" onclick="ImplicitSend()">
|
||||
<div id="accountManage">
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>账号</th>
|
||||
<th>id</th>
|
||||
<th>身份</th>
|
||||
<th>状态</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="accountTable">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<div id="recruitManage">
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>岗位</th>
|
||||
<th>id</th>
|
||||
<th>公司名</th>
|
||||
<th>公司ID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="recruitTable">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<span id="manageId" style="display: none"><%=session.getAttribute("accountID")%></span>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -1,25 +0,0 @@
|
||||
<%@ 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">
|
||||
<script src="/recruit/js/recruitManageForEntreprise.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="recruitManage">
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>岗位</th>
|
||||
<th>id</th>
|
||||
<th>公司名</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="recruitTable">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<span id="account" style="display: none"><%=session.getAttribute("account")%></span>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,110 +0,0 @@
|
||||
function createXMLHttpRequest() {
|
||||
let xmlHttpRequest;
|
||||
if (window.XMLHttpRequest) { // 非IE浏览器
|
||||
xmlHttpRequest = new XMLHttpRequest();
|
||||
}
|
||||
else if (window.ActiveXObject) { // IE浏览器
|
||||
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlHttpRequest;
|
||||
}
|
||||
|
||||
function logSend() {
|
||||
if (!document.getElementById("accountLog").value || !document.getElementById("passwordLog").value) {
|
||||
alert("重新输入");
|
||||
return;
|
||||
}
|
||||
let log = JSON.stringify({
|
||||
account: document.getElementById("accountLog").value,
|
||||
password: document.getElementById("passwordLog").value,
|
||||
authorization: null
|
||||
});
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/logSign", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let logSignResponse = xmlHttpRequest.responseText;
|
||||
let alertText = JSON.parse(logSignResponse).status;
|
||||
window.alert(alertText);
|
||||
window.location.reload(true);
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
console.log(log);
|
||||
xmlHttpRequest.send(log);
|
||||
}
|
||||
|
||||
function signSend() {
|
||||
let radios = document.getElementsByName('authorization');
|
||||
let authorization;
|
||||
if ((!radios[0].checked && !radios[1].checked) ||
|
||||
!document.getElementById("accountSign").value || !document.getElementById("passwordSign").value) {
|
||||
alert("重新输入");
|
||||
return;
|
||||
}
|
||||
if (radios[0].checked)
|
||||
authorization = radios[0].value;
|
||||
else
|
||||
authorization = radios[1].value;
|
||||
let sign = JSON.stringify({
|
||||
account: document.getElementById("accountSign").value,
|
||||
password: document.getElementById("passwordSign").value,
|
||||
authorization: authorization
|
||||
});
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/logSign", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let logSignResponse = xmlHttpRequest.responseText;
|
||||
let alertText = JSON.parse(logSignResponse).status;
|
||||
window.alert(alertText);
|
||||
window.location.href = "/recruit/logSign";
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
console.log(sign);
|
||||
xmlHttpRequest.send(sign);
|
||||
}
|
||||
|
||||
function deregistration() {
|
||||
let deregistrationJson = JSON.stringify({ status: "0" });
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/logSign", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.send(deregistrationJson);
|
||||
window.location.href = "/recruit/main";
|
||||
}
|
||||
|
||||
function modifyPassword() {
|
||||
let modifyPasswordJson = JSON.stringify({ newPassword: document.getElementById("passwordModifyBox").value });
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/logSign", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let logSignResponse = xmlHttpRequest.responseText;
|
||||
let alertText = JSON.parse(logSignResponse).status;
|
||||
window.alert(alertText);
|
||||
window.location.href = "/recruit/main";
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
console.log(modifyPasswordJson);
|
||||
xmlHttpRequest.send(modifyPasswordJson);
|
||||
}
|
||||
|
||||
function switchModifyBetweenLogged() {
|
||||
document.getElementById("logged").style.display = "none";
|
||||
document.getElementById("modify").style.display = "block";
|
||||
}
|
||||
@ -1,74 +0,0 @@
|
||||
function createXMLHttpRequest() {
|
||||
let xmlHttpRequest;
|
||||
if (window.XMLHttpRequest) { // 非IE浏览器
|
||||
xmlHttpRequest = new XMLHttpRequest();
|
||||
}
|
||||
else if (window.ActiveXObject) { // IE浏览器
|
||||
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlHttpRequest;
|
||||
}
|
||||
|
||||
function ImplicitSend(accountHiddenStatus) {
|
||||
let accountStatus = JSON.stringify({
|
||||
method: "recommand",
|
||||
accountStatus: accountHiddenStatus
|
||||
});
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/details", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let result = xmlHttpRequest.responseText;
|
||||
console.log(result);
|
||||
updateJsp(result);
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttpRequest.send(accountStatus);
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
const hiddenAccountStatus = document.getElementById("hiddenAccountStatus").value;
|
||||
const hiddenAccountAuthorization = document.getElementById("hiddenAccountAuthorization").value;
|
||||
ImplicitSend(hiddenAccountAuthorization);
|
||||
if (hiddenAccountAuthorization == "superManager" && hiddenAccountStatus == "1") {
|
||||
document.getElementById("profileAccess").style.display = "none";
|
||||
document.getElementById("manageAccess").style.display = "block";
|
||||
}
|
||||
if (hiddenAccountAuthorization == "entreprise" && hiddenAccountStatus == "1") {
|
||||
document.getElementById("entrepriseManageAccess").style.display = "block";
|
||||
document.getElementById("manageAccess").style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function updateJsp(result) {
|
||||
let recruitResult = JSON.parse(result);
|
||||
if (recruitResult != null) {
|
||||
const container = document.querySelector('#recruitTable');
|
||||
container.innerHTML = ""; //清空旧结果
|
||||
for (let item of recruitResult) {
|
||||
const tr = document.createElement('tr');
|
||||
const td1 = document.createElement('td');
|
||||
const td2 = document.createElement('td');
|
||||
const td3 = document.createElement('td');
|
||||
const td4 = document.createElement('td');
|
||||
const a = document.createElement('a');
|
||||
let uri = "/recruit/details?id=" + item.id;
|
||||
a.href = uri;
|
||||
a.textContent = item.name;
|
||||
td2.textContent = item.location;
|
||||
td3.textContent = item.salary;
|
||||
td4.textContent = item.company;
|
||||
td1.appendChild(a);
|
||||
tr.appendChild(td1);
|
||||
tr.appendChild(td2);
|
||||
tr.appendChild(td3);
|
||||
tr.appendChild(td4);
|
||||
container.appendChild(tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
function createXMLHttpRequest() {
|
||||
let xmlHttpRequest;
|
||||
if (window.XMLHttpRequest) { // 非IE浏览器
|
||||
xmlHttpRequest = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) { // IE浏览器
|
||||
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlHttpRequest;
|
||||
}
|
||||
|
||||
function recruitSend() {
|
||||
if (!document.getElementById("name").value || !document.getElementById("content").value
|
||||
|| !document.getElementById("location").value || !document.getElementById("salary").value
|
||||
|| !document.getElementById("companyName").value|| !document.getElementById("contactEmail").value) {
|
||||
alert("重新输入");
|
||||
return;
|
||||
}
|
||||
let recruitNew = JSON.stringify({
|
||||
name: document.getElementById("name").value,
|
||||
content: document.getElementById("content").value,
|
||||
location: document.getElementById("location").value,
|
||||
salary: document.getElementById("salary").value,
|
||||
company: document.getElementById("companyName").value,
|
||||
companyID: document.getElementById("account").value,
|
||||
contactEmail: document.getElementById("contactEmail").value
|
||||
});
|
||||
//没有输入类型验证
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/details", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let recruitResponse = xmlHttpRequest.responseText;
|
||||
let alertText = JSON.parse(recruitResponse).status;
|
||||
window.alert(alertText);
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttpRequest.send(recruitNew);
|
||||
}
|
||||
|
||||
function deleteRecruit()
|
||||
{
|
||||
let deleteJson = JSON.stringify({
|
||||
method:"delete",
|
||||
id:document.getElementById("hiddenId").innerText
|
||||
});
|
||||
console.log(deleteJson);
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/details", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let deleteResponse = xmlHttpRequest.responseText;
|
||||
let alertText = JSON.parse(deleteResponse).status;
|
||||
window.alert(alertText);
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttpRequest.send(deleteJson);
|
||||
}
|
||||
|
||||
//参考 https://blog.csdn.net/c_staunch/article/details/80968051
|
||||
@ -1,56 +0,0 @@
|
||||
function createXMLHttpRequest() {
|
||||
let xmlHttpRequest;
|
||||
if (window.XMLHttpRequest) { // 非IE浏览器
|
||||
xmlHttpRequest = new XMLHttpRequest();
|
||||
}
|
||||
else if (window.ActiveXObject) { // IE浏览器
|
||||
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlHttpRequest;
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
let implicitJson = JSON.stringify({
|
||||
method: "entrepriseManage",
|
||||
account: document.getElementById("account").innerText
|
||||
});
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/details", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let result = xmlHttpRequest.responseText;
|
||||
updateJsp(result);
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttpRequest.send(implicitJson);
|
||||
}
|
||||
|
||||
function updateJsp(result) {
|
||||
let recruitResult = JSON.parse(result);
|
||||
if (recruitResult != null) {
|
||||
const container = document.querySelector('#recruitTable');
|
||||
container.innerHTML = ""; //清空旧结果
|
||||
for (let item of recruitResult) {
|
||||
const tr = document.createElement('tr');
|
||||
const td1 = document.createElement('td');
|
||||
const td2 = document.createElement('td');
|
||||
const td3 = document.createElement('td');
|
||||
const a = document.createElement('a');
|
||||
let uri = "/recruit/details?id=" + item.id;
|
||||
a.href = uri;
|
||||
a.textContent = item.name;
|
||||
td2.textContent = item.id;
|
||||
td3.textContent = item.company;
|
||||
td1.appendChild(a);
|
||||
tr.appendChild(td1);
|
||||
tr.appendChild(td2);
|
||||
tr.appendChild(td3);
|
||||
container.appendChild(tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
function createXMLHttpRequest() {
|
||||
let xmlHttpRequest;
|
||||
if (window.XMLHttpRequest) { // 非IE浏览器
|
||||
xmlHttpRequest = new XMLHttpRequest();
|
||||
}
|
||||
else if (window.ActiveXObject) { // IE浏览器
|
||||
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlHttpRequest;
|
||||
}
|
||||
|
||||
function keySend() {
|
||||
if (!document.getElementById("searchBox").value) {
|
||||
alert("重新输入");
|
||||
return;
|
||||
}
|
||||
let searchKey = JSON.stringify({ searchKey: document.getElementById("searchBox").value });
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/search", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let searchResponse = xmlHttpRequest.responseText;
|
||||
updateJsp(searchResponse);
|
||||
document.getElementById("resultTable").style.display="block";
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttpRequest.send(searchKey);
|
||||
}
|
||||
|
||||
function updateJsp(searchResponse) {
|
||||
let searchUpdate = JSON.parse(searchResponse);
|
||||
console.log(searchUpdate);
|
||||
const container = document.querySelector('#show');
|
||||
container.innerHTML = ""; //清空旧结果
|
||||
for (let item of searchUpdate) {
|
||||
const tr = document.createElement('tr');
|
||||
const a = document.createElement('a');
|
||||
const td1 = document.createElement('td');
|
||||
const td2 = document.createElement('td');
|
||||
const td3 = document.createElement('td');
|
||||
const td4 = document.createElement('td');
|
||||
let uri = "/recruit/details?id=" + item.id;
|
||||
a.href = uri;
|
||||
a.onclick = "hitsAdd()";
|
||||
a.textContent = item.name;
|
||||
td2.textContent = item.location;
|
||||
td3.textContent = item.salary;
|
||||
td4.textContent = item.company;
|
||||
td1.appendChild(a);
|
||||
tr.appendChild(td1);
|
||||
tr.appendChild(td2);
|
||||
tr.appendChild(td3);
|
||||
tr.appendChild(td4);
|
||||
container.appendChild(tr);
|
||||
}
|
||||
}
|
||||
|
||||
//参考文章 https://blog.csdn.net/weixin_34718952/article/details/148485765,
|
||||
// https://www.zhihu.com/question/588007022
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
jdbcDriver=com.mysql.jdbc.Driver
|
||||
jdbcUri=jdbc:mysql://localhost:3306/recruit_db?useSSL=false&characterEncoding=utf8
|
||||
jdbcUser=root
|
||||
jdbcPassword=12345678
|
||||
@ -1,3 +0,0 @@
|
||||
artifactId=recruit
|
||||
groupId=com.example
|
||||
version=1.0-SNAPSHOT
|
||||
@ -1,19 +0,0 @@
|
||||
com\example\dao\RecruitDAO.class
|
||||
com\example\servlet\LogSignServlet.class
|
||||
com\example\servlet\MainPageServlet.class
|
||||
com\example\bean\RecruitBean.class
|
||||
com\example\servlet\ManageServlet.class
|
||||
com\example\servlet\ProfileServlet.class
|
||||
com\example\servlet\RecruitServlet.class
|
||||
com\example\dao\StudentProfileDAO.class
|
||||
com\example\servlet\SearchServlet.class
|
||||
com\example\dao\LogSignDAO.class
|
||||
com\example\utility\Connect.class
|
||||
com\example\bean\StudentProfileBean.class
|
||||
com\example\utility\HttpGetJson.class
|
||||
com\example\servlet\EntrepriseManage.class
|
||||
com\example\utility\SaltMD5Util.class
|
||||
com\example\bean\EntrepriseProfileBean.class
|
||||
com\example\bean\LogSignBean.class
|
||||
com\example\dao\EntrepriseProfileDAO.class
|
||||
com\example\listener\SessionListener.class
|
||||
@ -1,19 +0,0 @@
|
||||
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\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\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\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
|
||||
F:\Programme\recruit\recruit\src\main\java\com\example\servlet\ProfileServlet.java
|
||||
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
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
jdbcDriver=com.mysql.jdbc.Driver
|
||||
jdbcUri=jdbc:mysql://localhost:3306/recruit_db?useSSL=false&characterEncoding=utf8
|
||||
jdbcUser=root
|
||||
jdbcPassword=12345678
|
||||
@ -1,85 +0,0 @@
|
||||
<%@ 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">
|
||||
<script src="/recruit/js/entrepriseProfile.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
const account = '<%=session.getAttribute("account")%>';
|
||||
const accountID = '<%=session.getAttribute("accountID")%>';
|
||||
const accountAuthorization = '<%=session.getAttribute("accountAuthorization")%>';
|
||||
const accountStatus = '<%=session.getAttribute("accountStatus")%>';
|
||||
const studentProfileBean = '<%=session.getAttribute("studentProfileBean")%>';
|
||||
const isStudentProfileExisted = '<%=session.getAttribute("isStudentProfileExisted")%>';
|
||||
const entrepriseProfileBean = '<%=session.getAttribute("entrepriseProfileBean")%>';
|
||||
const isEntrepriseProfileExisted = '<%=session.getAttribute("isEntrepriseProfileExisted")%>';
|
||||
const companyName = '<%=session.getAttribute("companyName")%>';
|
||||
const contactEmail = '<%=session.getAttribute("contactEmail")%>';
|
||||
const recruitPageStatus = '<%=session.getAttribute("recruitPageStatus")%>';
|
||||
console.log("account " + account);
|
||||
console.log("accountID " + accountID);
|
||||
console.log("accountAuthorization " + accountAuthorization);
|
||||
console.log("accountStatus " + accountStatus);
|
||||
console.log("studentProfileBean " + studentProfileBean);
|
||||
console.log("isStudentProfileExisted " + isStudentProfileExisted);
|
||||
console.log("entrepriseProfileBean " + entrepriseProfileBean);
|
||||
console.log("isEntrepriseProfileExisted " + isEntrepriseProfileExisted);
|
||||
console.log("companyName " + companyName);
|
||||
console.log("contactEmail " + contactEmail);
|
||||
console.log("recruitPageStatus " + recruitPageStatus);
|
||||
if (accountAuthorization != 'null' && accountAuthorization != 'superManager' && accountStatus == "1") {
|
||||
if (isEntrepriseProfileExisted == "true") {
|
||||
document.getElementById("show").style.display = "block";
|
||||
}
|
||||
else {
|
||||
document.getElementById("new").style.display = "block";
|
||||
let hiddeMethod = document.getElementById("method")
|
||||
hiddeMethod.value = "create";
|
||||
}
|
||||
}
|
||||
else if (isEntrepriseProfileExisted == "true" && accountAuthorization == 'superManager') {
|
||||
document.getElementById("show").style.display = "block";
|
||||
document.getElementById("modifyButton").style.display = "none";
|
||||
}
|
||||
else if (isEntrepriseProfileExisted == "notExist" && accountAuthorization == 'superManager')
|
||||
document.getElementById("notExist").style.display = "block";
|
||||
else;
|
||||
}
|
||||
function modify() {
|
||||
document.getElementById("show").style.display = "none";
|
||||
document.getElementById("new").style.display = "block";
|
||||
document.getElementById("nameNew").value = document.getElementById("nameShow").innerText;
|
||||
document.getElementById("overviewNew").value = document.getElementById("overviewShow").innerText;
|
||||
document.getElementById("contactEmailNew").value = document.getElementById("contactEmailShow").innerText;
|
||||
let hiddeMethod = document.getElementById("method")
|
||||
hiddeMethod.value = "update";
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="show" style="display: none">
|
||||
<% com.example.bean.EntrepriseProfileBean entrepriseProfileBean=(com.example.bean.EntrepriseProfileBean)
|
||||
session.getAttribute("entrepriseProfileBean"); if(entrepriseProfileBean !=null) {
|
||||
session.setAttribute("companyName",entrepriseProfileBean.getName());
|
||||
session.setAttribute("contactEmail",entrepriseProfileBean.getContactEmail()); %>
|
||||
名称:<p id="nameShow"><%= entrepriseProfileBean.getName() %></p>
|
||||
概述:<p id="overviewShow"><%= entrepriseProfileBean.getOverview() %></p>
|
||||
联系邮箱:<p id="contactEmailShow"><%= entrepriseProfileBean.getContactEmail() %></p>
|
||||
<% } %>
|
||||
<input type="button" value="修改" onclick="modify()" id="modifyButton">
|
||||
</div><!--这是已创建企业资料后显示的部分-->
|
||||
<div id="new" style="display: none;">
|
||||
<label for="nameNew">名称:</label><input type="text" id="nameNew" autocomplete="off"><br>
|
||||
<label for="overviewNew">概述:</label><input type="text" id="overviewNew" autocomplete="off"><br>
|
||||
<label for="contactEmailNew">联系邮箱:</label><input type="text" id="contactEmailNew" autocomplete="off"><br>
|
||||
<input type="hidden" id="method"><br>
|
||||
<input type="button" value="提交" onclick="profileSend()">
|
||||
<!--这是未创建企业资料要提交的表单-->
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -1,91 +0,0 @@
|
||||
<div%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>logSign</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script>
|
||||
function logSignSwitch() {
|
||||
document.getElementById("log").style.display = "none";
|
||||
document.getElementById("sign").style.display = "block";
|
||||
}
|
||||
window.onload = function () {
|
||||
const account = '<%=session.getAttribute("account")%>';
|
||||
const accountID = '<%=session.getAttribute("accountID")%>';
|
||||
const accountAuthorization = '<%=session.getAttribute("accountAuthorization")%>';
|
||||
const accountStatus = '<%=session.getAttribute("accountStatus")%>';
|
||||
const studentProfileBean = '<%=session.getAttribute("studentProfileBean")%>';
|
||||
const isStudentProfileExisted = '<%=session.getAttribute("isStudentProfileExisted")%>';
|
||||
const entrepriseProfileBean = '<%=session.getAttribute("entrepriseProfileBean")%>';
|
||||
const isEntrepriseProfileExisted = '<%=session.getAttribute("isEntrepriseProfileExisted")%>';
|
||||
const companyName = '<%=session.getAttribute("companyName")%>';
|
||||
const contactEmail = '<%=session.getAttribute("contactEmail")%>';
|
||||
const recruitPageStatus = '<%=session.getAttribute("recruitPageStatus")%>';
|
||||
console.log("account " + account);
|
||||
console.log("accountID " + accountID);
|
||||
console.log("accountAuthorization " + accountAuthorization);
|
||||
console.log("accountStatus " + accountStatus);
|
||||
console.log("studentProfileBean " + studentProfileBean);
|
||||
console.log("isStudentProfileExisted " + isStudentProfileExisted);
|
||||
console.log("entrepriseProfileBean " + entrepriseProfileBean);
|
||||
console.log("isEntrepriseProfileExisted " + isEntrepriseProfileExisted);
|
||||
console.log("companyName " + companyName);
|
||||
console.log("contactEmail " + contactEmail);
|
||||
console.log("recruitPageStatus " + recruitPageStatus);
|
||||
if (accountAuthorization != 'null' && accountStatus == "1") {
|
||||
document.getElementById("log").style.display = "none";
|
||||
document.getElementById("logged").style.display = "block";
|
||||
document.getElementById("accountLogged").innerText = account;
|
||||
document.getElementById("authorizationLogged").innerText = accountAuthorization;
|
||||
}
|
||||
else
|
||||
document.getElementById("log").style.display = "block";
|
||||
}
|
||||
</script>
|
||||
<script src="/recruit/js/logSign.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="log" style="display:none">
|
||||
<form>
|
||||
<label for="accountLog">用户名:</lable>
|
||||
<input type="text" id="accountLog" autocomplete="off">
|
||||
<br>
|
||||
<label for="passwordLog">密码:</lable>
|
||||
<input type="password" id="passwordLog" autocomplete="off">
|
||||
<br>
|
||||
<input type="button" id="submitLog" value="登录" onclick="logSend()">
|
||||
</form>
|
||||
<input type="button" id="switch" value="注册" onclick="logSignSwitch()">
|
||||
</div><!--这是登录的部分-->
|
||||
<div id="sign" style="display:none">
|
||||
<form>
|
||||
<label for="accountSign">用户名:</lable>
|
||||
<input type="text" id="accountSign" autocomplete="off">
|
||||
<label for="passwordSign">密码:</lable>
|
||||
<input type="password" id="passwordSign" autocomplete="off">
|
||||
账户类型:
|
||||
<input type="radio" name="authorization" value="student">学生
|
||||
<input type="radio" name="authorization" value="entreprise">企业
|
||||
<input type="button" id="submitSign" value="确认" onclick="signSend()">
|
||||
</form>
|
||||
</div><!--这是注册的部分-->
|
||||
<div id="logged" style="display: none">
|
||||
<p>你已登录</p>
|
||||
<p>账号:</p>
|
||||
<p id="accountLogged"></p>
|
||||
<p>身份:</p>
|
||||
<p id="authorizationLogged"></p><br>
|
||||
<input type="button" id="modifyPasswordButton" value="修改密码" onclick="switchModifyBetweenLogged()">
|
||||
<input type="button" id="deregistration" value="退出" onclick="deregistration()">
|
||||
</div><!--这是已登录后显示的账号信息部分-->
|
||||
<div id="modify" style="display: none">
|
||||
<label for="passwordModifyBox">新密码:</lable><input type="text" id="passwordModifyBox" autocomplete="off">
|
||||
<input type="button" value="确认" onclick="modifyPassword()">
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -1,64 +0,0 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>mainPage</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="/recruit/js/mainPage.js"></script>
|
||||
<script>
|
||||
const account = '<%=session.getAttribute("account")%>';
|
||||
const accountID = '<%=session.getAttribute("accountID")%>';
|
||||
const accountAuthorization = '<%=session.getAttribute("accountAuthorization")%>';
|
||||
const accountStatus = '<%=session.getAttribute("accountStatus")%>';
|
||||
const studentProfileBean = '<%=session.getAttribute("studentProfileBean")%>';
|
||||
const isStudentProfileExisted = '<%=session.getAttribute("isStudentProfileExisted")%>';
|
||||
const entrepriseProfileBean = '<%=session.getAttribute("entrepriseProfileBean")%>';
|
||||
const isEntrepriseProfileExisted = '<%=session.getAttribute("isEntrepriseProfileExisted")%>';
|
||||
const companyName = '<%=session.getAttribute("companyName")%>';
|
||||
const contactEmail = '<%=session.getAttribute("contactEmail")%>';
|
||||
const recruitPageStatus = '<%=session.getAttribute("recruitPageStatus")%>';
|
||||
const objectAccount = '<%=session.getAttribute("objectAccount")%>';
|
||||
console.log("account " + account);
|
||||
console.log("accountID " + accountID);
|
||||
console.log("accountAuthorization " + accountAuthorization);
|
||||
console.log("accountStatus " + accountStatus);
|
||||
console.log("studentProfileBean " + studentProfileBean);
|
||||
console.log("isStudentProfileExisted " + isStudentProfileExisted);
|
||||
console.log("entrepriseProfileBean " + entrepriseProfileBean);
|
||||
console.log("isEntrepriseProfileExisted " + isEntrepriseProfileExisted);
|
||||
console.log("companyName " + companyName);
|
||||
console.log("contactEmail " + contactEmail);
|
||||
console.log("recruitPageStatus " + recruitPageStatus);
|
||||
console.log("objectAccount " + objectAccount);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<input type="text" id="hiddenAccountStatus" style="display: none" value="<%=session.getAttribute("accountStatus")%>">
|
||||
<input type="text" id="hiddenAccountAuthorization" style="display: none" value="<%=session.getAttribute("accountAuthorization")%>">
|
||||
<a href="/recruit/logSign">登录/注册</a>
|
||||
<br>
|
||||
<a href="/recruit/search">搜索</a>
|
||||
<br>
|
||||
<a href="/recruit/profile" id="profileAccess">账户资料</a>
|
||||
<a href="/recruit/manage" id="manageAccess" style="display:none">管理</a>
|
||||
<a href="/recruit/entrepriseManage" id="entrepriseManageAccess" style="display:none">发布招聘项管理</a>
|
||||
<h2>当前热门</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>岗位</th>
|
||||
<th>地区</th>
|
||||
<th>工资</th>
|
||||
<th>公司</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="recruitTable">
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -1,70 +0,0 @@
|
||||
<%@ 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">
|
||||
<script src="/recruit/js/manage.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
const account = '<%=session.getAttribute("account")%>';
|
||||
const accountID = '<%=session.getAttribute("accountID")%>';
|
||||
const accountAuthorization = '<%=session.getAttribute("accountAuthorization")%>';
|
||||
const accountStatus = '<%=session.getAttribute("accountStatus")%>';
|
||||
const studentProfileBean = '<%=session.getAttribute("studentProfileBean")%>';
|
||||
const isStudentProfileExisted = '<%=session.getAttribute("isStudentProfileExisted")%>';
|
||||
const entrepriseProfileBean = '<%=session.getAttribute("entrepriseProfileBean")%>';
|
||||
const isEntrepriseProfileExisted = '<%=session.getAttribute("isEntrepriseProfileExisted")%>';
|
||||
const companyName = '<%=session.getAttribute("companyName")%>';
|
||||
const contactEmail = '<%=session.getAttribute("contactEmail")%>';
|
||||
const recruitPageStatus = '<%=session.getAttribute("recruitPageStatus")%>';
|
||||
console.log("account " + account);
|
||||
console.log("accountID " + accountID);
|
||||
console.log("accountAuthorization " + accountAuthorization);
|
||||
console.log("accountStatus " + accountStatus);
|
||||
console.log("studentProfileBean " + studentProfileBean);
|
||||
console.log("isStudentProfileExisted " + isStudentProfileExisted);
|
||||
console.log("entrepriseProfileBean " + entrepriseProfileBean);
|
||||
console.log("isEntrepriseProfileExisted " + isEntrepriseProfileExisted);
|
||||
console.log("companyName " + companyName);
|
||||
console.log("contactEmail " + contactEmail);
|
||||
console.log("recruitPageStatus " + recruitPageStatus);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<input type="button" id="trigger" value="查询信息" onclick="ImplicitSend()">
|
||||
<div id="accountManage">
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>账号</th>
|
||||
<th>id</th>
|
||||
<th>身份</th>
|
||||
<th>状态</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="accountTable">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<div id="recruitManage">
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>岗位</th>
|
||||
<th>id</th>
|
||||
<th>公司名</th>
|
||||
<th>公司ID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="recruitTable">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<span id="manageId" style="display: none"><%=session.getAttribute("accountID")%></span>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -1,25 +0,0 @@
|
||||
<%@ 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">
|
||||
<script src="/recruit/js/recruitManageForEntreprise.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="recruitManage">
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>岗位</th>
|
||||
<th>id</th>
|
||||
<th>公司名</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="recruitTable">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<span id="account" style="display: none"><%=session.getAttribute("account")%></span>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,101 +0,0 @@
|
||||
<div%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="32kb" autoFlush="true"
|
||||
%>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="/recruit/js/studentProfile.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
const account = '<%=session.getAttribute("account")%>';
|
||||
const accountID = '<%=session.getAttribute("accountID")%>';
|
||||
const accountAuthorization = '<%=session.getAttribute("accountAuthorization")%>';
|
||||
const accountStatus = '<%=session.getAttribute("accountStatus")%>';
|
||||
const studentProfileBean = '<%=session.getAttribute("studentProfileBean")%>';
|
||||
const isStudentProfileExisted = '<%=session.getAttribute("isStudentProfileExisted")%>';
|
||||
const entrepriseProfileBean = '<%=session.getAttribute("entrepriseProfileBean")%>';
|
||||
const isEntrepriseProfileExisted = '<%=session.getAttribute("isEntrepriseProfileExisted")%>';
|
||||
const companyName = '<%=session.getAttribute("companyName")%>';
|
||||
const contactEmail = '<%=session.getAttribute("contactEmail")%>';
|
||||
const recruitPageStatus = '<%=session.getAttribute("recruitPageStatus")%>';
|
||||
const objectAccount = '<%=session.getAttribute("objectAccount")%>';
|
||||
console.log("account " + account);
|
||||
console.log("accountID " + accountID);
|
||||
console.log("accountAuthorization " + accountAuthorization);
|
||||
console.log("accountStatus " + accountStatus);
|
||||
console.log("studentProfileBean " + studentProfileBean);
|
||||
console.log("isStudentProfileExisted " + isStudentProfileExisted);
|
||||
console.log("entrepriseProfileBean " + entrepriseProfileBean);
|
||||
console.log("isEntrepriseProfileExisted " + isEntrepriseProfileExisted);
|
||||
console.log("companyName " + companyName);
|
||||
console.log("contactEmail " + contactEmail);
|
||||
console.log("recruitPageStatus " + recruitPageStatus);
|
||||
console.log("objectAccount " + objectAccount);
|
||||
if (accountAuthorization != 'null' && accountAuthorization != 'superManager' && accountStatus == "1") {
|
||||
if (isStudentProfileExisted == "true")
|
||||
document.getElementById("show").style.display = "block";
|
||||
else {
|
||||
document.getElementById("new").style.display = "block";
|
||||
let hiddeMethod = document.getElementById("method")
|
||||
hiddeMethod.value = "create";
|
||||
}
|
||||
}
|
||||
else if (isStudentProfileExisted == "true" && accountAuthorization == 'superManager') {
|
||||
document.getElementById("show").style.display = "block";
|
||||
document.getElementById("modifyButton").style.display = "none";
|
||||
document.getElementById("deleteButton").style.display = "block";
|
||||
}
|
||||
else if (isStudentProfileExisted == "notExist" && accountAuthorization == 'superManager') {
|
||||
document.getElementById("notExist").style.display = "block";
|
||||
document.getElementById("show").style.display = "block";
|
||||
document.getElementById("deleteButton").style.display = "block";
|
||||
}
|
||||
else
|
||||
document.getElementById("notLog").style.display = "block";
|
||||
}
|
||||
|
||||
function modify() {
|
||||
document.getElementById("show").style.display = "none";
|
||||
document.getElementById("new").style.display = "block";
|
||||
document.getElementById("nameNew").value = document.getElementById("nameShow").innerText;
|
||||
document.getElementById("ageNew").value = document.getElementById("ageShow").innerText;
|
||||
document.getElementById("locationNew").value = document.getElementById("locationShow").innerText;
|
||||
document.getElementById("interestNew").value = document.getElementById("interestShow").innerText;
|
||||
let hiddeMethod = document.getElementById("method")
|
||||
hiddeMethod.value = "update";
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="show" style="display: none;">
|
||||
<% com.example.bean.StudentProfileBean studentProfileBean=(com.example.bean.StudentProfileBean)
|
||||
session.getAttribute("studentProfileBean"); if(studentProfileBean !=null) { %>
|
||||
姓名:<span id="nameShow"><%= studentProfileBean.getName() %></span><br>
|
||||
年龄:<span id="ageShow"><%= studentProfileBean.getAge() %></span><br>
|
||||
现居:<span id="locationShow"><%= studentProfileBean.getLocation() %></span><br>
|
||||
兴趣:<span id="interestShow"><%= studentProfileBean.getInterest() %></span><br>
|
||||
<input type="button" value="修改" onclick="modify()" id="modifyButton">
|
||||
<p id="hiddenAccount" style="display: none"><%= studentProfileBean.getStudenID() %></p>
|
||||
<% } %>
|
||||
<input type="button" id="deleteButton" value="删除" onclick="deleteAccount()" style="display: none"> <!--删除账号本身-->
|
||||
</div><!--这是已创建个人资料后显示的部分-->
|
||||
<div id="new" style="display: none;">
|
||||
<label for="nameNew">姓名:</label><input type="text" id="nameNew" autocomplete="off"><br>
|
||||
<label for="ageNew">年龄:</label><input type="text" id="ageNew" autocomplete="off"><br>
|
||||
<label for="locationNew">现居:</label><input type="text" id="locationNew" autocomplete="off"><br>
|
||||
<label for="interestNew">兴趣:</label><input type="text" id="interestNew" autocomplete="off"><br>
|
||||
<input type="hidden" id="method"><br>
|
||||
<input type="button" value="提交" onclick="profileSend()">
|
||||
</div><!--这是未创建个人资料要提交的表单-->
|
||||
<div id="notLog" style="display:none">
|
||||
<h3>你未登录</h3>
|
||||
</div>
|
||||
<div id="notExist" style="display:none">
|
||||
<h3>不存在</h3>
|
||||
<input type="button" id="deleteButton" value="删除" onclick="deleteAccount()" style="display: none"> <!--删除账号本身-->
|
||||
<p id="hiddenAccount" style="display: none"><%= session.getAttribute("objectAccount") %></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,7 +0,0 @@
|
||||
<!DOCTYPE web-app PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||
|
||||
<web-app>
|
||||
<display-name>Archetype Created Web Application</display-name>
|
||||
</web-app>
|
||||
@ -1,110 +0,0 @@
|
||||
function createXMLHttpRequest() {
|
||||
let xmlHttpRequest;
|
||||
if (window.XMLHttpRequest) { // 非IE浏览器
|
||||
xmlHttpRequest = new XMLHttpRequest();
|
||||
}
|
||||
else if (window.ActiveXObject) { // IE浏览器
|
||||
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlHttpRequest;
|
||||
}
|
||||
|
||||
function logSend() {
|
||||
if (!document.getElementById("accountLog").value || !document.getElementById("passwordLog").value) {
|
||||
alert("重新输入");
|
||||
return;
|
||||
}
|
||||
let log = JSON.stringify({
|
||||
account: document.getElementById("accountLog").value,
|
||||
password: document.getElementById("passwordLog").value,
|
||||
authorization: null
|
||||
});
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/logSign", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let logSignResponse = xmlHttpRequest.responseText;
|
||||
let alertText = JSON.parse(logSignResponse).status;
|
||||
window.alert(alertText);
|
||||
window.location.reload(true);
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
console.log(log);
|
||||
xmlHttpRequest.send(log);
|
||||
}
|
||||
|
||||
function signSend() {
|
||||
let radios = document.getElementsByName('authorization');
|
||||
let authorization;
|
||||
if ((!radios[0].checked && !radios[1].checked) ||
|
||||
!document.getElementById("accountSign").value || !document.getElementById("passwordSign").value) {
|
||||
alert("重新输入");
|
||||
return;
|
||||
}
|
||||
if (radios[0].checked)
|
||||
authorization = radios[0].value;
|
||||
else
|
||||
authorization = radios[1].value;
|
||||
let sign = JSON.stringify({
|
||||
account: document.getElementById("accountSign").value,
|
||||
password: document.getElementById("passwordSign").value,
|
||||
authorization: authorization
|
||||
});
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/logSign", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let logSignResponse = xmlHttpRequest.responseText;
|
||||
let alertText = JSON.parse(logSignResponse).status;
|
||||
window.alert(alertText);
|
||||
window.location.href = "/recruit/logSign";
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
console.log(sign);
|
||||
xmlHttpRequest.send(sign);
|
||||
}
|
||||
|
||||
function deregistration() {
|
||||
let deregistrationJson = JSON.stringify({ status: "0" });
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/logSign", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.send(deregistrationJson);
|
||||
window.location.href = "/recruit/main";
|
||||
}
|
||||
|
||||
function modifyPassword() {
|
||||
let modifyPasswordJson = JSON.stringify({ newPassword: document.getElementById("passwordModifyBox").value });
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/logSign", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let logSignResponse = xmlHttpRequest.responseText;
|
||||
let alertText = JSON.parse(logSignResponse).status;
|
||||
window.alert(alertText);
|
||||
window.location.href = "/recruit/main";
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
console.log(modifyPasswordJson);
|
||||
xmlHttpRequest.send(modifyPasswordJson);
|
||||
}
|
||||
|
||||
function switchModifyBetweenLogged() {
|
||||
document.getElementById("logged").style.display = "none";
|
||||
document.getElementById("modify").style.display = "block";
|
||||
}
|
||||
@ -1,74 +0,0 @@
|
||||
function createXMLHttpRequest() {
|
||||
let xmlHttpRequest;
|
||||
if (window.XMLHttpRequest) { // 非IE浏览器
|
||||
xmlHttpRequest = new XMLHttpRequest();
|
||||
}
|
||||
else if (window.ActiveXObject) { // IE浏览器
|
||||
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlHttpRequest;
|
||||
}
|
||||
|
||||
function ImplicitSend(accountHiddenStatus) {
|
||||
let accountStatus = JSON.stringify({
|
||||
method: "recommand",
|
||||
accountStatus: accountHiddenStatus
|
||||
});
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/details", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let result = xmlHttpRequest.responseText;
|
||||
console.log(result);
|
||||
updateJsp(result);
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttpRequest.send(accountStatus);
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
const hiddenAccountStatus = document.getElementById("hiddenAccountStatus").value;
|
||||
const hiddenAccountAuthorization = document.getElementById("hiddenAccountAuthorization").value;
|
||||
ImplicitSend(hiddenAccountAuthorization);
|
||||
if (hiddenAccountAuthorization == "superManager" && hiddenAccountStatus == "1") {
|
||||
document.getElementById("profileAccess").style.display = "none";
|
||||
document.getElementById("manageAccess").style.display = "block";
|
||||
}
|
||||
if (hiddenAccountAuthorization == "entreprise" && hiddenAccountStatus == "1") {
|
||||
document.getElementById("entrepriseManageAccess").style.display = "block";
|
||||
document.getElementById("manageAccess").style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function updateJsp(result) {
|
||||
let recruitResult = JSON.parse(result);
|
||||
if (recruitResult != null) {
|
||||
const container = document.querySelector('#recruitTable');
|
||||
container.innerHTML = ""; //清空旧结果
|
||||
for (let item of recruitResult) {
|
||||
const tr = document.createElement('tr');
|
||||
const td1 = document.createElement('td');
|
||||
const td2 = document.createElement('td');
|
||||
const td3 = document.createElement('td');
|
||||
const td4 = document.createElement('td');
|
||||
const a = document.createElement('a');
|
||||
let uri = "/recruit/details?id=" + item.id;
|
||||
a.href = uri;
|
||||
a.textContent = item.name;
|
||||
td2.textContent = item.location;
|
||||
td3.textContent = item.salary;
|
||||
td4.textContent = item.company;
|
||||
td1.appendChild(a);
|
||||
tr.appendChild(td1);
|
||||
tr.appendChild(td2);
|
||||
tr.appendChild(td3);
|
||||
tr.appendChild(td4);
|
||||
container.appendChild(tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
function createXMLHttpRequest() {
|
||||
let xmlHttpRequest;
|
||||
if (window.XMLHttpRequest) { // 非IE浏览器
|
||||
xmlHttpRequest = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) { // IE浏览器
|
||||
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlHttpRequest;
|
||||
}
|
||||
|
||||
function recruitSend() {
|
||||
if (!document.getElementById("name").value || !document.getElementById("content").value
|
||||
|| !document.getElementById("location").value || !document.getElementById("salary").value
|
||||
|| !document.getElementById("companyName").value|| !document.getElementById("contactEmail").value) {
|
||||
alert("重新输入");
|
||||
return;
|
||||
}
|
||||
let recruitNew = JSON.stringify({
|
||||
name: document.getElementById("name").value,
|
||||
content: document.getElementById("content").value,
|
||||
location: document.getElementById("location").value,
|
||||
salary: document.getElementById("salary").value,
|
||||
company: document.getElementById("companyName").value,
|
||||
companyID: document.getElementById("account").value,
|
||||
contactEmail: document.getElementById("contactEmail").value
|
||||
});
|
||||
//没有输入类型验证
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/details", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let recruitResponse = xmlHttpRequest.responseText;
|
||||
let alertText = JSON.parse(recruitResponse).status;
|
||||
window.alert(alertText);
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttpRequest.send(recruitNew);
|
||||
}
|
||||
|
||||
function deleteRecruit()
|
||||
{
|
||||
let deleteJson = JSON.stringify({
|
||||
method:"delete",
|
||||
id:document.getElementById("hiddenId").innerText
|
||||
});
|
||||
console.log(deleteJson);
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/details", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let deleteResponse = xmlHttpRequest.responseText;
|
||||
let alertText = JSON.parse(deleteResponse).status;
|
||||
window.alert(alertText);
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttpRequest.send(deleteJson);
|
||||
}
|
||||
|
||||
//参考 https://blog.csdn.net/c_staunch/article/details/80968051
|
||||
@ -1,56 +0,0 @@
|
||||
function createXMLHttpRequest() {
|
||||
let xmlHttpRequest;
|
||||
if (window.XMLHttpRequest) { // 非IE浏览器
|
||||
xmlHttpRequest = new XMLHttpRequest();
|
||||
}
|
||||
else if (window.ActiveXObject) { // IE浏览器
|
||||
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlHttpRequest;
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
let implicitJson = JSON.stringify({
|
||||
method: "entrepriseManage",
|
||||
account: document.getElementById("account").innerText
|
||||
});
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/details", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let result = xmlHttpRequest.responseText;
|
||||
updateJsp(result);
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttpRequest.send(implicitJson);
|
||||
}
|
||||
|
||||
function updateJsp(result) {
|
||||
let recruitResult = JSON.parse(result);
|
||||
if (recruitResult != null) {
|
||||
const container = document.querySelector('#recruitTable');
|
||||
container.innerHTML = ""; //清空旧结果
|
||||
for (let item of recruitResult) {
|
||||
const tr = document.createElement('tr');
|
||||
const td1 = document.createElement('td');
|
||||
const td2 = document.createElement('td');
|
||||
const td3 = document.createElement('td');
|
||||
const a = document.createElement('a');
|
||||
let uri = "/recruit/details?id=" + item.id;
|
||||
a.href = uri;
|
||||
a.textContent = item.name;
|
||||
td2.textContent = item.id;
|
||||
td3.textContent = item.company;
|
||||
td1.appendChild(a);
|
||||
tr.appendChild(td1);
|
||||
tr.appendChild(td2);
|
||||
tr.appendChild(td3);
|
||||
container.appendChild(tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
function createXMLHttpRequest() {
|
||||
let xmlHttpRequest;
|
||||
if (window.XMLHttpRequest) { // 非IE浏览器
|
||||
xmlHttpRequest = new XMLHttpRequest();
|
||||
}
|
||||
else if (window.ActiveXObject) { // IE浏览器
|
||||
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlHttpRequest;
|
||||
}
|
||||
|
||||
function keySend() {
|
||||
if (!document.getElementById("searchBox").value) {
|
||||
alert("重新输入");
|
||||
return;
|
||||
}
|
||||
let searchKey = JSON.stringify({ searchKey: document.getElementById("searchBox").value });
|
||||
let xmlHttpRequest = createXMLHttpRequest();
|
||||
xmlHttpRequest.open("POST", "/recruit/search", true);
|
||||
xmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlHttpRequest.status === 200) {
|
||||
let searchResponse = xmlHttpRequest.responseText;
|
||||
updateJsp(searchResponse);
|
||||
document.getElementById("resultTable").style.display="block";
|
||||
} else {
|
||||
console.error('Server response error:', xmlHttpRequest.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttpRequest.send(searchKey);
|
||||
}
|
||||
|
||||
function updateJsp(searchResponse) {
|
||||
let searchUpdate = JSON.parse(searchResponse);
|
||||
console.log(searchUpdate);
|
||||
const container = document.querySelector('#show');
|
||||
container.innerHTML = ""; //清空旧结果
|
||||
for (let item of searchUpdate) {
|
||||
const tr = document.createElement('tr');
|
||||
const a = document.createElement('a');
|
||||
const td1 = document.createElement('td');
|
||||
const td2 = document.createElement('td');
|
||||
const td3 = document.createElement('td');
|
||||
const td4 = document.createElement('td');
|
||||
let uri = "/recruit/details?id=" + item.id;
|
||||
a.href = uri;
|
||||
a.onclick = "hitsAdd()";
|
||||
a.textContent = item.name;
|
||||
td2.textContent = item.location;
|
||||
td3.textContent = item.salary;
|
||||
td4.textContent = item.company;
|
||||
td1.appendChild(a);
|
||||
tr.appendChild(td1);
|
||||
tr.appendChild(td2);
|
||||
tr.appendChild(td3);
|
||||
tr.appendChild(td4);
|
||||
container.appendChild(tr);
|
||||
}
|
||||
}
|
||||
|
||||
//参考文章 https://blog.csdn.net/weixin_34718952/article/details/148485765,
|
||||
// https://www.zhihu.com/question/588007022
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue