预备:

数据库

本次作业选择的数据库为MYSQL,采用的数据库管理工具为Navicat Premium12。MYSQL下载地址为https://dev.mysql.com/downloads/mysql/

使用Navicat连接数据库。

1.首先打开Navicat图形化管理界面,点击连接,若在本地开发,主机和端口没有占用的话直接默认的就可以。用户名和密码均为root,之后便可建立与数据库的链接,后面的数据库操作均可通过Navicat控制完成。

gKyG8g.png

使用Navicat连接MYSQL数据库界面

2.设置Tomcat服务器,Java链接数据库最常用的就是通过jar包导入之后直接使用封装好的方法来实现的,安装JDBC驱动即可。本人使用的Tomcat版本为9.0.24,其中JDBC驱动为mysql-connector-java-5.1.48-bin.jar。将该jar包拷贝到服务器的lib文件夹中。重新启动服务器,能够成功启动即可。

3.最后通过eclipse建立JSP文件来测试能否实现数据库的连接。

测试内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>

<html>
<head>
<title>页面输出数据库中制定数据表数据</title>
</head>
<body>

<%
try {
Class.forName("com.mysql.jdbc.Driver"); //驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; //数据库名
String username = "root"; //数据库用户名
String password = "root"; //数据库用户密码
Connection conn = DriverManager.getConnection(url, username, password); //连接状态

if(conn != null){
out.print("数据库连接成功!");
out.print("<br />");
Statement stmt = null;
ResultSet rs = null;
String sql = "SELECT *FROM students;"; //查询语句
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
out.print("查询结果:");
out.print("<br />");
out.println("姓名"+" "+"电话 ");
out.print("<br />");
while (rs.next()) {
out.println(rs.getString("name")+" &nbsp "+rs.getString("tel")+" &nbsp "); //将查询结果输出
out.print("<br />");
}
}
else{
out.print("连接失败!");
}
}catch (Exception e) {
out.print("数据库连接异常!");
}
%>
</body>
</html>
gKyHXX.png

使用Navicat看到的数据表中的数据

gKy52G.png

在网页端看到的数据表中的数据

二者内容一致说明数据库连接成功!

开始项目:

开发工具为Eclipse Java Photon。做好所有的预备工作后,即可开始开发。

开发时应注意代码的复用性以及可维护性。具体表现在:

1.所有代码分好类别存储,便于维护和修改。

2.涉及到数值问题的都用符号求得后表示,若绝对写死,一旦数据库中数据数量发生变化,项目在运行过程中容易出错。

3.数据库中数据表的设计应尽量减少冗余,在进行数据的操作时尽量使用多表查询,减轻服务器以及数据库的负担。

登录注册页的实现

需要注意的地方:

1.“永远不要相信用户的输入”,并非所有的用户输入都符合系统需求。在注册时添加确认密码一项使得用户能有缓冲时间。

2.输入时得情况判断:(1)用户是否输入完整。(2)输入完整时账号密码都正确、输入的账号不存在、输入的账号存在密码错误

需要注意的细节:在安全角度来讲,一旦用户输入密码错误不要单纯的给用户提示“密码错误”,最好提示“账号或密码错误”,在大型系统中防止黑客的暴力破解。

3.登录整体使用MVC的设计模式,通过JSP前端页面产生交互信息,交互信息与bean和servlet产生交互效果。

bean

useInfo.java:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package bean;

import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Connection;

public class userInfo {
String account;
String password;

public String getAccount() {
return account;
}

public void setAccount(String account) {
this.account = account;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

/* 链接数据库,将信息存入 */

public boolean storeMsg(userInfo u) throws SQLException, ClassNotFoundException {
Class.forName("com.mysql.jdbc.Driver"); // 驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; // 数据库名
String username = "root"; // 数据库用户名
String password = "root"; // 数据库用户密码
Connection conn = DriverManager.getConnection(url, username, password); // 连接状态

String acc = u.getAccount();
String pass = u.getPassword();

String sql_check = "select * from user where account=?";

PreparedStatement ps_check = conn.prepareStatement(sql_check );
ps_check.setString(1, acc);
/* ps.setString(2, pass); */
ResultSet rs = null;
rs = ps_check.executeQuery();
if (!rs.next()) {
//说明不存在该账号
String sql = "insert into user(account,password) values (?,?)";

PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, acc);
ps.setString(2, pass);
int result = 0;
result = ps.executeUpdate();

/* 关闭数据库 */
ps.close();
conn.close();

if (result > 0) {
return true;
} else {
return false;
}
}else {
/* 关闭数据库 */
ps_check.close();
conn.close();
return false;
}


}

/* 数据的检索 */
public boolean checkMsg(userInfo u) throws SQLException, ClassNotFoundException {
Class.forName("com.mysql.jdbc.Driver"); // 驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; // 数据库名
String username = "root"; // 数据库用户名
String password = "root"; // 数据库用户密码
Connection conn = DriverManager.getConnection(url, username, password); // 连接状态

ResultSet rs = null;

String acc = u.getAccount();
/* String pass = u.getPassword(); */
String sql = "select * from user where account=?";

PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, acc);
/* ps.setString(2, pass); */

rs = ps.executeQuery();
if (rs.next()) {
u.setAccount(rs.getString(2));
u.setPassword(rs.getString(3));
/* 关闭数据库 */
ps.close();
conn.close();
return true;
} else {
/* 关闭数据库 */
ps.close();
conn.close();
return false;
}

}
}

login.jsp:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<html>
<head>
<title>登录</title>
<link rel="stylesheet" href="css/login.css">
<link rel="icon" href="img/headicon.png">
</head>
<body>
<div class="main">
<h1>登录</h1>
<form action="login" method="post">
<p>账号</p>
<input type="text" name="account" />
<p>密码</p>
<input type="password" name="password" />
<input type="submit" value="提交">
<a href="register.jsp">
<input type="button" value="注册">
</a>
</form>
</div>
<%
request.setCharacterEncoding("utf-8");
String account = request.getParameter("account");
String password = request.getParameter("password");

if (account == null) {
account = "";
}
if (password == null) {
password = "";
}
%>
</body>
</html>

login.java:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package servlet;

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

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

import bean.userInfo;

/**
* Servlet implementation class login
*/
@WebServlet("/login")
public class login extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public login() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
/* 将得到的与数据库中进行比对,成功即可进入 */
request.setCharacterEncoding("utf-8");
HttpSession session = request.getSession();
//得到登陆界面输入的账号密码
String account = request.getParameter("account");
String password = request.getParameter("password");

//检测是否数据都输入完整
if (account.equals("") || password.equals("")) {
request.setCharacterEncoding("gb2312");
// 在这里使用jsp:forward会使得css作用不上
session.setAttribute("msg", "请将所有信息填写完整");
response.sendRedirect("error/error.jsp");
} else {
/* 进行数据库中数据的判定 */

//将账号和密码赋值到bean中
userInfo u = new userInfo();
u.setAccount(account);
u.setPassword(password);

try {

//调用bean中方法检测是否和数据库中存在的数据相同
boolean data = u.checkMsg(u);

//检测状态:1账号密码正确时、2.账号不存在时、3.二者有一个输入错误时

if (data) {
if (account.equals(u.getAccount()) && password.equals(u.getPassword())) {
// 此时登录成功,在session中存入此时账号信息,供后面页面使用
session.setAttribute("account", account);
response.sendRedirect("main/main.jsp");
} else {

/*
* String a=u.getAccount(); String b=u.getPassword();
*
* String c=a+"----"+b; session.setAttribute("msg", c);
*/
session.setAttribute("msg", "账号或密码错误,请重新输入");
response.sendRedirect("error/error.jsp");
}
} else {
session.setAttribute("msg", "该账号不存在");
response.sendRedirect("error/error.jsp");
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

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

}

register.jsp:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<html>
<head>
<title>注册</title>
<link rel="stylesheet" href="css/login.css">
<style>
body {
background: url("img/B3.jpg");
background-size: cover;
}
</style>
</head>
<body>
<div class="main">
<h1>注册</h1>
<form action="register" method="post">
<p>账号</p>
<input type="text" name="account" />
<p>密码</p>
<input type="password" name="password" />
<p>确认密码</p>
<input type="password" name="checkPass" />
<input type="submit" value="确定">
</form>
</div>
<%
request.setCharacterEncoding("utf-8");
String account = request.getParameter("account");
String password = request.getParameter("password");
String checkPass = request.getParameter("checkPass");
if (account == null || password == null || checkPass == null) {
account = "";
password = "";
checkPass = "";
}
%>
</body>
</html>

register.java:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package servlet;

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

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

import bean.userInfo;

/**
* Servlet implementation class register
*/
@WebServlet("/register")
public class register extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public register() {
super();
// TODO Auto-generated constructor stub
}

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

HttpSession session = request.getSession();
request.setCharacterEncoding("utf-8");
String account = request.getParameter("account");
String password = request.getParameter("password");
String checkPass = request.getParameter("checkPass");
if (account.equals("") || password.equals("") || checkPass.equals("")) {
session.setAttribute("msg", "请将所有信息输入完整_");
response.sendRedirect("error/error.jsp");
} else {
if (!password.equals(checkPass)) {
session.setAttribute("msg", "两次输入的密码不一致,请重新输入_");
response.sendRedirect("error/error.jsp");
} else {

/* 将账号、信息存入数据库中 */
userInfo u = new userInfo();
u.setAccount(account);
u.setPassword(password);

try {
if (u.storeMsg(u)) {
session.setAttribute("account", account+"");
session.setAttribute("password", password+"");
response.sendRedirect("success/regSuc.jsp");
}else {

//说明有重复的账号
session.setAttribute("msg", "该账号已被注册");
response.sendRedirect("error/error.jsp");
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}
}

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

}

页面截图:

gK59qc.png

登录页

gK5LxK.png

注册页

### 主页面的实现

主页面中展示的为相关编程语言信息,里面的按钮为系统中最重要的可交互元素,其中数据全部来源于数据库,这样通过遍历在数据库中读数据可大大减少前端代码量,减轻前端开发时的负担。

main.jsp:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>主页</title>
<link rel="stylesheet" href="../css/main.css">
<link rel="icon" href="../img/headicon.png">
</head>
<body>
<div class="head">
<span>computer's language</span>
<a href="../person/person.jsp"><span class="head_peo">欢迎你,<%=session.getAttribute("account")%></span></a>
<a href="../person/mygoods.jsp"><span class="head_peo">个人购物车</span></a>
</div>
<div class="container">
<%
try {
Class.forName("com.mysql.jdbc.Driver"); //驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; //数据库名
String username = "root"; //数据库用户名
String password = "root"; //数据库用户密码
Connection conn = DriverManager.getConnection(url, username, password); //连接状态

if (conn != null) {
Statement stmt = null;
ResultSet rs = null;
String sql = "SELECT *FROM content;"; //查询语句
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);

int all = 0;
while (rs.next()) {
all++;
session.setAttribute("num", all + "");
%>
<div class="item">
<div class="img">
<img src=<%=rs.getString("img")%> alt="python">
</div>
<div class="font">
<p><%=rs.getString("language")%></p>
<p class="describe"><%=rs.getString("des")%></p>
</div>
<div class="button">

<!-- 通过点击不同的按钮跳到指定相关的购物界面 -->
<form action="../goshop" method="post">
<input type="submit" name=<%=rs.getString("id") + "_learn"%>
value="学习" class="more">
</form>
<form action="../getContent" method="post">
<input type="submit" name=<%=rs.getString("id") + "_like"%>
value="喜欢" class="like">
</form>
<a href=<%=rs.getString("url")%> target="_blank">
<button class="official">官网</button>
</a>
</div>
</div>
<%
}
} else {
out.print("连接失败!");
}
} catch (Exception e) {
out.print("数据库连接异常!");
}
%>
</div>
</body>
</html>

goshop.java:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package servlet;

import java.io.IOException;

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

/**
* Servlet implementation class goshop
*/
@WebServlet("/goshop")
public class goshop extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public goshop() {
super();
// TODO Auto-generated constructor stub
}

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

/*主要起到存储session信息的作用*/
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;chartset=utf-8");
HttpSession session = request.getSession();
// 得到语言的总条数,
String n = (String) session.getAttribute("num");
int num = Integer.parseInt(n);
//因为数据库中语言的id是从0开始的,所以一种值 对应一种语言
for (int i = 0; i < num; i++) {
if (request.getParameter(i + "_learn") != null) {
// 说明点击了对应语言的学习,将该信息存入session中方便shop页的使用
session.setAttribute("learn", i + "");
// 重定向
response.sendRedirect("shop/shop.jsp");
}
}

}

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

getContent.java:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

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

/**
* Servlet implementation class getContent
*/
@WebServlet("/getContent")
public class getContent extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public getContent() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
/*
* response.getWriter().append("Served at: ").append(request.getContextPath());
*/
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;chartset=utf-8");

//得到session中存在的账号信息
HttpSession session = request.getSession();
PrintWriter out = response.getWriter();
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // 驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; // 数据库名
String username = "root"; // 数据库用户名
String password = "root"; // 数据库用户密码
try {
Connection conn = DriverManager.getConnection(url, username, password);

Statement stmt = null;
ResultSet rs = null;

String sql = "insert into user_like(account,language_id) values (?,?)";
String acc = (String) session.getAttribute("account");
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, acc);

// 得到数据总条数
String n = (String) session.getAttribute("num");
int num = Integer.parseInt(n);
// 用于检测是否插入成功
int result = 0;
for (int i = 0; i < num; i++) {
if (request.getParameter(i + "_like") != null) {

// 首先检测是否已存在改记录
String test_sql = "select * from user_like where account="+acc+" and language_id="+i;
stmt = conn.createStatement();
rs = stmt.executeQuery(test_sql);

if (rs.next()) {
// 说明该纪录已存在
session.setAttribute("msg", "你已点击了喜欢");
// 重定向
response.sendRedirect("error/showMsg.jsp");

} else {
ps.setInt(2, i);
result = ps.executeUpdate();
ps.close();
conn.close();
if (result > 0) {
out.print("插入成功");
out.print(num);
result = 0;
// 重定向
response.sendRedirect("success/insertSuc.jsp");
} else {
out.print("插入失败");
}
}

}
}

} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // 连接状态

}

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

主页面截图:

gK82nt.png

主页

个人页面的实现

个人页面中主要展示用户喜欢的编程语言,在这个页面可进行已保存数据的删除,数据全部来自数据库。

该页中的用户信息来自session的存储,(这种方式并不安全,如果浏览器禁掉cookie使用,那么将无法产生该有的作用,我这只是为了使得项目中能够使用到session知识点)

person.jsp:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>个人页面</title>
<link rel="stylesheet" href="../css/person.css">
</head>
<body>
<div class="head">
<span>个人页面</span> <a href="../main/main.jsp"><span
class="head_peo">主页面</span></a>
</div>
<div class="container">

<%
//获得当前的账号
session.getAttribute("account");
//链接数据库获取当前用户的语言喜欢信息
try {
Class.forName("com.mysql.jdbc.Driver"); //驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; //数据库名
String username = "root"; //数据库用户名
String password = "root"; //数据库用户密码
Connection conn = DriverManager.getConnection(url, username, password); //连接状态

if (conn != null) {
/* out.print("数据库连接成功!");
out.print("<br />"); */
Statement stmt = null;
ResultSet rs = null;
//操作前已去除重复记录
String sql = "SELECT user_like.id, language,language_id,des,url,img FROM user_like,content where user_like.language_id=content.id and account="
+ (String) session.getAttribute("account"); //查询语句
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);

while (rs.next()) {
%>
<div class="item">
<div class="img">
<img src=<%=rs.getString("img")%>>
</div>
<div class="font">
<p><%=rs.getString("language")%></p>
</div>
<div class="button">
<form action="../deleteLike" method="post">
<input type="submit"
name=<%=rs.getString("language_id") + "_unlike"%> value="取消喜欢"
class="like">
</form>
<a href=<%=rs.getString("url")%> target="_blank">
<button class="official">官网</button>
</a>
</div>
</div>
<%
/* out.println(rs.getString("user_like.id") ); //将查询结果输出
out.print("<br />"); */
}
} else {
out.print("连接失败!");
}
} catch (Exception e) {
out.print("数据库连接异常!");
}
%>

</div>

</body>
</html>

deleteLike.java:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

import java.sql.SQLException;

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

/**
* Servlet implementation class deleteLike
*/
@WebServlet("/deleteLike")
public class deleteLike extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public deleteLike() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;chartset=utf-8");
HttpSession session = request.getSession();
PrintWriter out = response.getWriter();
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // 驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; // 数据库名
String username = "root"; // 数据库用户名
String password = "root"; // 数据库用户密码
try {
Connection conn = DriverManager.getConnection(url, username, password);

String sql = "delete from user_like where account=? and language_id=?";
String acc = (String) session.getAttribute("account");
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, acc);

// 得到数据总条数
String n = (String) session.getAttribute("num");
int num = Integer.parseInt(n);
// 用于检测是否成功
int result = 0;
for (int i = 0; i < num; i++) {
if (request.getParameter(i + "_unlike") != null) {

// 此处不用检测是否已存在改记录
ps.setInt(2, i);
result = ps.executeUpdate();
ps.close();
conn.close();
if (result > 0) {
/*out.print("删除");
out.print(num);*/
result = 0;
// 重定向
response.sendRedirect("success/deleteSuc.jsp");
} else {
out.print("删除失败");
}
}

}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // 连接状态
}

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

个人页面截图:

gK8kZJ.png

个人页面

学习资料页面的实现

用户在主页面点击不同语言的学习按钮,会显示不同的学习资料,主要使用SQL查询来实现,通过唯一的主键来确定。并且支持学习资料的购买个数选择。

shop.jsp:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>

<html>
<head>
<title>学习资料</title>
<link rel="stylesheet" href="../css/shop.css">
</head>
<body>
<div class="head">
<span>学习资料</span> <a href="../main/main.jsp"><span
class="head_peo">回到主页</span></a>
</div>
<div class="container">
<%
/* 开始读取对应语言的工具书 */

//链接数据库获取当前用户的语言喜欢信息
try {
Class.forName("com.mysql.jdbc.Driver"); //驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; //数据库名
String username = "root"; //数据库用户名
String password = "root"; //数据库用户密码
Connection conn = DriverManager.getConnection(url, username, password); //连接状态

if (conn != null) {
/* out.print("数据库连接成功!");
out.print("<br />"); */
Statement stmt = null;
ResultSet rs = null;
//查询操作

//session中记录了该种语言的id值,id是唯一的
String sql = "SELECT id,bprice, bdes,img,lid FROM goods where lid in (select id from content where id="
+ (String) session.getAttribute("learn") + ")"; //查询语句
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);

while (rs.next()) {
%>

<div class="item">
<img src=<%=rs.getString("img")%> alt="">
<hr style="height: 2px; border: none; border-top: 5px ridge black;" />
<div class="price">
¥<%=rs.getFloat("bprice")%>
</div>
<div class="describe">
<%=rs.getString("bdes")%>
</div>
<div class="operation">

<form action="../buyGoods" method="post">
<span>购买数量:</span>
<select name="buyNum">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<input type="submit" value="购买" name=<%=rs.getString("id") +"_buy"%>>
</form>
</div>
</div>

<%
/* out.println(rs.getString("user_like.id") ); //将查询结果输出
out.print("<br />"); */
}
} else {
out.print("连接失败!");
}
} catch (Exception e) {
out.print("数据库连接异常!");
}
%>
</div>
</body>
</html>

buyGoods.java:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;

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

/**
* Servlet implementation class buyGoods
*/
@WebServlet("/buyGoods")
public class buyGoods extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public buyGoods() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
// 此页处理用户购买的物品,并将购买记录存入数据库

// 获取数据库中所有的物品
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;chartset=utf-8");
HttpSession session = request.getSession();
PrintWriter out = response.getWriter();
try {
Class.forName("com.mysql.jdbc.Driver"); // 驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; // 数据库名
String username = "root"; // 数据库用户名
String password = "root"; // 数据库用户密码
Connection conn = DriverManager.getConnection(url, username, password); // 连接状态

if (conn != null) {
Statement stmt = null;
ResultSet rs = null;
String sql = "SELECT * FROM goods;"; // 查询语句
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
// 获取书籍的数据总条数
int count = 0;
while (rs.next()) {
count++;
}


out.print(count);
// 得到点击的按钮位置,从0开始是因为数据表中的id是从0开始的
for (int i = 0; i < count; i++) {
if (request.getParameter(i + "_buy") != null) {
// 获取购买数量和账号信息,之后将这条数据存入数据表中

String acc = (String) session.getAttribute("account");
String num = request.getParameter("buyNum");
int number=Integer.parseInt(num);

/*out.print(account);
out.print("<br/>");
out.print(num);

//得到该商品在数据表中的id
out.print("-----"+i);*/
int result=0;
String sql_buy = "insert into buy(account,gid,num) values (?,?,?)";
PreparedStatement ps = conn.prepareStatement(sql_buy);
ps.setString(1, acc);
ps.setInt(2, i);
ps.setInt(3, number);
result = ps.executeUpdate();
ps.close();
conn.close();
if (result > 0) {
out.print("插入成功");
out.print(num);
result = 0;
// 重定向
response.sendRedirect("success/insertSuc1.jsp");
} else {
out.print("插入失败");
}
}
}

} else {
out.print("连接失败!");
}
} catch (Exception e) {
out.print("数据库连接异常!");
}

}

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

相关截图:

gK8t50.png

学习资料页

gK8ZX1.png

购买成功

购物车页面的实现

购物车中主要为用户添加的相关学习资料信息,在这个页面用户可取消相关资料的购买,同时也可以对已经加入购物车的数据进行数量的修改,之后页面中重新显示所有的价钱。

mygoods.jsp:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.ArrayList"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>购物车</title>
<link rel="stylesheet" href="../css/shop.css">
</head>

<%
float money = 0;
%>
<body>
<div class="head" style="margin-bottom: 0">
<span>购物车</span> <a href="../main/main.jsp"><span class="head_peo">主页面</span></a>
</div>
<div class="container">

<%
//获得当前的账号
session.getAttribute("account");
//链接数据库获取当前用户的语言喜欢信息
try {
Class.forName("com.mysql.jdbc.Driver"); //驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; //数据库名
String username = "root"; //数据库用户名
String password = "root"; //数据库用户密码
Connection conn = DriverManager.getConnection(url, username, password); //连接状态

if (conn != null) {
/* out.print("数据库连接成功!");
out.print("<br />"); */
Statement stmt = null;
ResultSet rs = null;
//操作前已去除重复记录
String sql = "select * from goods,buy where buy.gid=goods.id and account="
+ (String) session.getAttribute("account"); //查询语句
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
ArrayList<Integer> List = new ArrayList<Integer>();
while (rs.next()) {
money += rs.getInt("num") * rs.getFloat("bprice");
List.add(rs.getInt("buy.id"));
session.setAttribute("list", List);
%>
<div class="item" style="margin-top: 40px;height:400px;">
<img src=<%=rs.getString("img")%> alt="">
<hr style="height: 2px; border: none; border-top: 5px ridge black;" />
<div class="price">
¥<%=rs.getFloat("bprice")%>
</div>
<div class="describe">
<%=rs.getString("bdes")%>
</div>
<div class="operation">

<form action="../deleteBuy" method="post">
<span>购买数量:<%=rs.getInt("num")%></span> <input type="submit"
value="取消购买" name=<%=rs.getInt("buy.id") + "_notBuy"%>>
</form>
</div>
<hr style="height: 2px; border: none; border-top: 2px ridge black;margin-top:20px;" />
<div class="operation">

<form action="../changeBuyNum" method="post">
<span>修改购买数量:</span>
<select name="buyNum">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<input type="submit" value="确定" name=<%=rs.getInt("buy.id") + "_changeBuy"%> style="background:green;">
</form>
</div>
</div>
<%
/* out.println(rs.getString("user_like.id") ); //将查询结果输出
out.print("<br />"); */
}
} else {
out.print("连接失败!");
}
} catch (Exception e) {
out.print("数据库连接异常!");
}
%>

</div>
<div class="all">
一共<%=money%>元
</div>
</body>
</html>

deleteBuy.java:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;

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

/**
* Servlet implementation class deleteBuy
*/
@WebServlet("/deleteBuy")
public class deleteBuy extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public deleteBuy() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
// 该页面主要用于已购买商品的删除
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;chartset=utf-8");
HttpSession session = request.getSession();
PrintWriter out = response.getWriter();
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // 驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; // 数据库名
String username = "root"; // 数据库用户名
String password = "root"; // 数据库用户密码
try {
Connection conn = DriverManager.getConnection(url, username, password);

//此时的id为buy表中的id,唯一
String sql = "delete from buy where id=?";
/* String acc = (String) session.getAttribute("account"); */
PreparedStatement ps = conn.prepareStatement(sql);
/* ps.setString(1, acc); */

// 得到数据总条数
/*
* String n = (String) session.getAttribute("num"); int num =
* Integer.parseInt(n);
*/

ArrayList<Integer> num = (ArrayList<Integer>) session.getAttribute("list");
// 用于检测是否成功
int result = 0;
// 检测是否存入arraylist
out.print(num);
for (int i = 0; i < num.size(); i++) {
if (request.getParameter(num.get(i) + "_notBuy") != null) {

/* out.print(num.get(i)); */

// 此处不用检测是否已存在改记录
ps.setInt(1, num.get(i));
result = ps.executeUpdate();
ps.close();
conn.close();
if (result > 0) {
out.print("删除");
out.print(num);
result = 0;
// 重定向
response.sendRedirect("success/notBuySuc.jsp");
} else {
out.print("删除失败");
}
}

}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // 连接状态

}

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

changeBuyNum.java:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

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

/**
* Servlet implementation class changeBuyNum
*/
@WebServlet("/changeBuyNum")
public class changeBuyNum extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public changeBuyNum() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
// 修改商品的购买数量
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;chartset=utf-8");
HttpSession session = request.getSession();
PrintWriter out = response.getWriter();
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // 驱动程序名
String url = "jdbc:mysql://localhost:3306/test"; // 数据库名
String username = "root"; // 数据库用户名
String password = "root"; // 数据库用户密码
try {
Connection conn = DriverManager.getConnection(url, username, password);

String sql = "update buy set num=? where id=?";
PreparedStatement ps = conn.prepareStatement(sql);
ArrayList<Integer> num = (ArrayList<Integer>) session.getAttribute("list");
// 用于检测是否成功
int result = 0;
// 检测是否存入arraylist
out.print(num);
for (int i = 0; i < num.size(); i++) {
if (request.getParameter(num.get(i) + "_changeBuy") != null) {

/* out.print(num.get(i)); */
// 得到修改后的购买数量
String number = request.getParameter("buyNum");
int sum = Integer.parseInt(number);

ps.setInt(1, sum);
ps.setInt(2, num.get(i));
result = ps.executeUpdate();
ps.close();
conn.close();
if (result > 0) {
out.print("修改");
out.print(num);
result = 0;
// 重定向
response.sendRedirect("success/changeNumSuc.jsp");
} else {
out.print("修改失败");
}
}

}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // 连接状态

}

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

相关截图:

gK8env.png

购物车

数据库表的设计: 设计理念为尽可能地减少数据表地冗余性,增加相关性
相关文章
评论
分享
  • JavaEE开发准备

    个人电脑硬件配置: Windows 10 64位家庭中文版 8G运行内存 Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz 1.Java JDK安装及配置(1)下载和安装首先进入oracle网站中Ja...

    JavaEE开发准备
  • JSP实现简单的购物车

    主要知识点:jsp指令标记、动作标记、内置对象request、response、session等的使用。 直接上代码: login.jsp: 1234567891011121314151617181920212223242526272...

    JSP实现简单的购物车
  • JSP初识

    JSP(Java Server Page),由Sun公司倡导,许多公司参与,于1999年(与我年龄一样!!!)推出的一种Web服务设计标准。 注释HTML注释: 1<!--需要注释的HTML内容--> JSP注释: 1&...

    JSP初识
  • Java工具类

    API(Application Programming Interface)1.包装类Java是面向对象的语言,但其中存在基本类型,违背了面向对象的思想。 包装类是基本类型与引用类型之间交换的桥梁 类型 包装类 byte ...

    Java工具类
  • Java设计模式

    设计模式:设计模式常用的有23种。设计模式是一种设计经验的总结,为了解决某些场景下的某一类的问题,是一种通用的解决方案 创建型(5):解决对象创建的过程 结构型(7):把类或对象通过某种形式结合在一起 行为型(11):解决类或对象之间...

    Java设计模式
  • Scanner类的学习

    Scanner类导包:java.util 创建对象:Scanner input =new Scanner(System.in); 使用: int value = input.nextInt(); ​ String va...

    Scanner类的学习
  • 引用类型对象方法返回值问题

    想要通过对象方法交换两个数组中的值 目前采用了两种方法: (1)一次交换二者数组中的值 (2)交互两数组的数组名 (1) 1234567891011121314151617181920212223242526272829303132...

    引用类型对象方法返回值问题
  • Java入门到入土

    Java体系12345678910111213141516171819202122基础部分(JavaSE):1.面向对象的编程思想2.集合3.I/O流 底层MVC4.文件5.缓存6.反射、注解数据库(JDBC)+WEB(JavaEE)...

    Java入门到入土
  • Windows下neo4j的安装

    neo4j是一个高性能的NOSQL图形数据库,他将结构化数据存储在网络上而不是表中。他是一个嵌入式的、基于磁盘的、具备完全的事物特性的Java持久化引擎,neo4j也可看做是一个高性能的图引擎,该引擎具有成熟数据库的所有特性。——百度...

    Windows下neo4j的安装
  • java实现类FTP程序

    继承程序设计实验,实验说明如图所示: 集成程序设计实验 TCP实现首先说明下基于TCP实现的功能: (1)能够实现多用户的同时连接 (2)用户执行成功的命令会在其他用户终端上显式说明 (3)当前用户数以及在线情况会在服务端实时显...

    java实现类FTP程序
Please check the comment setting in config.yml of hexo-theme-Annie!