1. System introduction
This project is developed usingidea tools, jsp+spring+spring-mvc+mybatis+jquery< /span> development tool. navicatTechnically written, the database uses mysql,
The system is divided into 2 roles: administrator and user
2. Module Introduction
administrator
1. Login
2. Personal information management
3. User management
4. Classification management
5. Tag management
6. Photo album management
7. Comment management
8. Message management
Get address:xystgl · master · code theft_java_bishe / java system · GitCode
user
1. Log in and register
2. Browse albums and photos
3. View users
4. Apply to add friends
5. Comment on photos
6. Download photos
7. Send messages to friends
8. History query
Project Introduction
Difficulty Level: ✩✩✩
User Type: 2 Roles (Administrator, User)
Design pattern: MVC
Project architecture: B/S architecture
Development language: Java language
Front-end technology: HTML, CSS , JS, JQuery, etc.
Back-end technology: JSP, ssm framework
Running environment: Windows 7 or 10, JDK1.8
Running tools: This system is developed using idea. It only supports idea running and does not support MyEclipse and eclipse running. Because the skeletons of the three are different, forcing the import to open and run may cause unknown errors. (If you want to run with eclipse, you need to convert!!!)
Database: MySQL5.5/5.7/8.0 version
Running server: Tomcat7.0 /8.0/8.5/9.0 and other versions
Whether it is based on Maven environment: No
Whether it uses a framework: Yes
Number of database tables: 9 tables
Number of JSP pages: more than 20 tables
Whether there is paging: There is paging
Related screenshots
Related code
Log in
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>个人相册系统</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" type="text/css" href="<%=path %>/resource/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="<%=path %>/resource/layui/css/admin.css">
<link rel="stylesheet" type="text/css" href="<%=path %>/resource/layui/css/login.css">
</head>
<body>
<form id="loginForm" name="loginForm">
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
<div class="layadmin-user-login-main">
<div class="layadmin-user-login-box layadmin-user-login-header">
<h2>个人相册系统</h2>
</div>
<div class="layadmin-user-login-box layadmin-user-login-body layui-form">
<div class="layui-form-item">
<label class="layadmin-user-login-icon layui-icon layui-icon-userName"></label>
<input type="text" name="username" lay-verify="username" id="username" placeholder="用户名"
class="layui-input">
</div>
<div class="layui-form-item">
<label class="layadmin-user-login-icon layui-icon layui-icon-password"></label>
<input type="password" name="password" lay-verify="password" id="password" placeholder="密码"
class="layui-input">
</div>
<div class="layui-form-item" style="align:center;">
   
<!-- <div class="layui-input-block"> -->
<input type="radio" name="type" value="1" title="管理员" checked>
<input type="radio" name="type" value="2" title="用户">
<!-- </div> -->
</div>
<div class="layui-form-item">
<button type="button" id="login" class="layui-btn layui-btn-fluid">登陆</button>
</div>
</div>
</div>
</div>
</form>
<script src="<%=path %>/resource/layui/layui.js"></script>
<script src="<%=path %>/resource/layui/jquery-1.9.1.min.js"></script>
<script>
$("#login").click(function(){
var username = $.trim($('#username').val());
var password = $.trim($("#password").val());
if (username == '') {
layer.msg('用戶名不能为空', function () {
time:2000
});
return false;
}
if (password == '') {
layer.msg('密码不能为空', function () {
time:2000
});
return false;
}
$.ajax({
cache: true,
type: "post",
url: "login",
data: $("#loginForm").serialize(),
async: false,
success: function (e) {
if (e == 'ok') {
alert("登录成功!");
window.parent.location.href = "toMain";
} else if (e == 'toIndex') {
alert("登录成功!");
window.parent.location.href = "toIndex";
} else {
alert("登录失败,账号或者密码错误!");
}
}
})
});
</script>
<script>
layui.use(['form', 'jquery', 'layer'], function () {
var form = layui.form,
layer = layui.layer,
$ = layui.jquery;
form.render();//这句一定要加,占坑
});
</script>
</body>
</html>
/**
* 登录
* @param username
* @param request
* @param password
* @param session
* @param response
* @param mv
* @return
* @throws ServletException
* @throws IOException
*/
@RequestMapping("/login")
@ResponseBody
public String login(@RequestParam("username")String username,
HttpServletRequest request, @RequestParam("password")String password,
HttpSession session, HttpServletResponse response, ModelAndView mv) throws ServletException, IOException {
session.removeAttribute("admin");
session.removeAttribute("student");
String type=request.getParameter("type").toString();
request.getSession().setAttribute("type", type);
String message = "error";
if(type != null && type.equals("1")){
Admin admin1 = service.selectAdmin(username,password);
if(admin1 != null){
request.getSession().setAttribute("admin", admin1);
message = "ok";
}
}else if(type != null && type.equals("2")){
User te = service.selectUser(username,password);
if(te != null){
request.getSession().setAttribute("user", te);
message = "toIndex";
}
}
return message;
}