基于javaweb的SSM个人博客管理系统(java+ssm+html+jq+jsp+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

230023342402

240023342402

250023342402

260023342402

280023342402

290023342402

基于javaweb的SSM个人博客管理系统(java+ssm+html+jq+jsp+mysql)

项目介绍

管理员角色包含以下功能: 发博客,审核评论,博客增删改查,博客类别增删改查,修改导航,评论增删改查,个人信息修改,登陆页面等功能。

游客角色包含以下功能: 博客首页,查看博客详情,按照日志类别查找,发表评论等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;  5.数据库:MySql 5.7版本;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录

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:55 */     ServletContext application = RequestContextUtils.getWebApplicationContext(request).getServletContext();
/* 41:56 */ Blogger blogger = this.bloggerService.find();
/* 42:57 */ blogger.setPassword(null);
/* 43:58 */ application.setAttribute("blogger", blogger);
/* 44: */
/* 45:60 */ List<BlogType> blogTypeCountList = this.blogTypeService.countList();
/* 46:61 */ application.setAttribute("blogTypeCountList", blogTypeCountList);
/* 47: */
/* 48:63 */ List<Blog> blogCountList = this.blogService.countList();
/* 49:64 */ application.setAttribute("blogCountList", blogCountList);
/* 50: */
/* 51:66 */ List<Link> linkList = this.linkService.list(null);
/* 52:67 */ application.setAttribute("linkList", linkList);
/* 53: */
/* 54:69 */ JSONObject result = new JSONObject();
/* 55:70 */ result.put("success", Boolean.valueOf(true));
/* 56:71 */ ResponseUtil.write(response, result);
/* 57:72 */ return null;
/* 58: */ }
/* 59: */ }



/* Location: D:\classes\

* Qualified Name: com.blog.controller.admin.SystemAdminController

* JD-Core Version: 0.7.0.1

*/
/* 1: */ package com.blog.controller;
/* 2: */
/* 16: */
/* 17: */ @Controller
/* 18: */ @RequestMapping({"/comment"})
/* 19: */ public class CommentController
/* 20: */ {
/* 21: */ @Resource
/* 22: */ private CommentService commentService;
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
/*  36: 52 */     List<BlogType> blogTypeList = this.blogTypeService.list(map);
/* 37: 53 */ Long total = this.blogTypeService.getTotal(map);
/* 38: 54 */ JSONObject result = new JSONObject();
/* 39: 55 */ JSONArray jsonArray = JSONArray.fromObject(blogTypeList);
/* 40: 56 */ result.put("rows", jsonArray);
/* 41: 57 */ result.put("total", total);
/* 42: 58 */ ResponseUtil.write(response, result);
/* 43: 59 */ return null;
/* 44: */ }
/* 45: */
/* 46: */ @RequestMapping({"/save"})
/* 47: */ public String save(BlogType blogType, HttpServletResponse response)
/* 48: */ throws Exception
/* 49: */ {
/* 50: 71 */ int resultTotal = 0;
/* 51: 72 */ if (blogType.getId() == null) {
/* 52: 73 */ resultTotal = this.blogTypeService.add(blogType).intValue();
/* 53: */ } else {
/* 54: 75 */ resultTotal = this.blogTypeService.update(blogType).intValue();
/* 55: */ }
/* 56: 77 */ JSONObject result = new JSONObject();
/* 57: 78 */ if (resultTotal > 0) {
/* 58: 79 */ result.put("success", Boolean.valueOf(true));
/* 59: */ } else {
/* 60: 81 */ result.put("success", Boolean.valueOf(false));
/* 61: */ }
/* 62: 83 */ ResponseUtil.write(response, result);
/* 63: 84 */ return null;
/* 64: */ }
/* 65: */
/* 66: */ @RequestMapping({"/delete"})
/* 67: */ public String delete(@RequestParam("ids") String ids, HttpServletResponse response)
/* 68: */ throws Exception
/* 69: */ {
/* 70: 96 */ String[] idsStr = ids.split(",");
/* 71: 97 */ JSONObject result = new JSONObject();
/* 72: 98 */ for (int i = 0; i < idsStr.length; i++) {
/* 73: 99 */ if (this.blogService.getBlogByTypeId(Integer.valueOf(Integer.parseInt(idsStr[i]))).intValue() > 0) {
/* 74:100 */ result.put("exist", "博客类别下有博客,不能删除!");
/* 75: */ } else {
/* 76:102 */ this.blogTypeService.delete(Integer.valueOf(Integer.parseInt(idsStr[i])));
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
/*  72: 93 */     ResponseUtil.write(response, result);
/* 73: 94 */ return null;
/* 74: */ }
/* 75: */
/* 76: */ @RequestMapping({"/delete"})
/* 77: */ public String delete(@RequestParam("ids") String ids, HttpServletResponse response)
/* 78: */ throws Exception
/* 79: */ {
/* 80:106 */ String[] idsStr = ids.split(",");
/* 81:107 */ for (int i = 0; i < idsStr.length; i++)
/* 82: */ {
/* 83:108 */ this.blogService.delete(Integer.valueOf(Integer.parseInt(idsStr[i])));
/* 84:109 */ this.blogIndex.deleteIndex(idsStr[i]);
/* 85: */ }
/* 86:111 */ JSONObject result = new JSONObject();
/* 87:112 */ result.put("success", Boolean.valueOf(true));
/* 88:113 */ ResponseUtil.write(response, result);
/* 89:114 */ return null;
/* 90: */ }
/* 91: */
/* 92: */ @RequestMapping({"/findById"})
/* 93: */ public String findById(@RequestParam("id") String id, HttpServletResponse response)
/* 94: */ throws Exception
/* 95: */ {
/* 96:126 */ Blog blog = this.blogService.findById(Integer.valueOf(Integer.parseInt(id)));
/* 97:127 */ JSONObject jsonObject = JSONObject.fromObject(blog);
/* 98:128 */ ResponseUtil.write(response, jsonObject);
/* 99:129 */ return null;
/* 100: */ }
/* 101: */ }



/* Location: D:\classes\

* Qualified Name: com.blog.controller.admin.BlogAdminController

* JD-Core Version: 0.7.0.1

*/
/* 1: */ package com.blog.controller.admin;
/* 2: */
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
/*  31:    */   public String save(Blog blog, HttpServletResponse response)
/* 32: */ throws Exception
/* 33: */ {
/* 34: 51 */ int resultTotal = 0;
/* 35: 52 */ if (blog.getId() == null)
/* 36: */ {
/* 37: 53 */ resultTotal = this.blogService.add(blog).intValue();
/* 38: 54 */ this.blogIndex.addIndex(blog);
/* 39: */ }
/* 40: */ else
/* 41: */ {
/* 42: 56 */ resultTotal = this.blogService.update(blog).intValue();
/* 43: 57 */ this.blogIndex.updateIndex(blog);
/* 44: */ }
/* 45: 59 */ JSONObject result = new JSONObject();
/* 46: 60 */ if (resultTotal > 0) {
/* 47: 61 */ result.put("success", Boolean.valueOf(true));
/* 48: */ } else {
/* 49: 63 */ result.put("success", Boolean.valueOf(false));
/* 50: */ }
/* 51: 65 */ ResponseUtil.write(response, result);
/* 52: 66 */ return null;
/* 53: */ }
/* 54: */
/* 55: */ @RequestMapping({"/list"})
/* 56: */ public String list(@RequestParam(value="page", required=false) String page, @RequestParam(value="rows", required=false) String rows, Blog s_blog, HttpServletResponse response)
/* 57: */ throws Exception
/* 58: */ {
/* 59: 80 */ PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
/* 60: 81 */ Map<String, Object> map = new HashMap();
/* 61: 82 */ map.put("title", StringUtil.formatLike(s_blog.getTitle()));
/* 62: 83 */ map.put("start", Integer.valueOf(pageBean.getStart()));
/* 63: 84 */ map.put("size", Integer.valueOf(pageBean.getPageSize()));
/* 64: 85 */ List<Blog> blogList = this.blogService.list(map);
/* 65: 86 */ Long total = this.blogService.getTotal(map);
/* 66: 87 */ JSONObject result = new JSONObject();
/* 67: 88 */ JsonConfig jsonConfig = new JsonConfig();
/* 68: 89 */ jsonConfig.registerJsonValueProcessor(Date.class, new DateJsonValueProcessor("yyyy-MM-dd"));
/* 69: 90 */ JSONArray jsonArray = JSONArray.fromObject(blogList, jsonConfig);
/* 70: 91 */ result.put("rows", jsonArray);
/* 71: 92 */ result.put("total", total);
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
 */
/* 1: */ package com.blog.controller.admin;
/* 2: */
/* 17: */
/* 18: */ @Controller
/* 19: */ @RequestMapping({"/admin/link"})
/* 20: */ public class LinkAdminController
/* 21: */ {
/* 22: */ @Resource
/* 23: */ private LinkService linkService;
/* 24: */
/* 25: */ @RequestMapping({"/list"})
/* 26: */ public String list(@RequestParam(value="page", required=false) String page, @RequestParam(value="rows", required=false) String rows, HttpServletResponse response)
/* 27: */ throws Exception
/* 28: */ {
/* 29:44 */ PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
/* 30:45 */ Map<String, Object> map = new HashMap();
/* 31:46 */ map.put("start", Integer.valueOf(pageBean.getStart()));
/* 32:47 */ map.put("size", Integer.valueOf(pageBean.getPageSize()));
/* 33:48 */ List<Link> linkList = this.linkService.list(map);
/* 34:49 */ Long total = this.linkService.getTotal(map);
/* 35:50 */ JSONObject result = new JSONObject();
/* 36:51 */ JSONArray jsonArray = JSONArray.fromObject(linkList);
/* 37:52 */ result.put("rows", jsonArray);
/* 38:53 */ result.put("total", total);
/* 39:54 */ ResponseUtil.write(response, result);
/* 40:55 */ return null;
/* 41: */ }
/* 42: */
/* 43: */ @RequestMapping({"/save"})
/* 44: */ public String save(Link link, HttpServletResponse response)
/* 45: */ throws Exception
/* 46: */ {
/* 47:67 */ int resultTotal = 0;
/* 48:68 */ if (link.getId() == null) {
/* 49:69 */ resultTotal = this.linkService.add(link);
/* 50: */ } else {
/* 51:71 */ resultTotal = this.linkService.update(link);
/* 52: */ }
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
/* 21:   */   
/* 22: */ @RequestMapping({"/login"})
/* 23: */ public String login(Blogger blogger, HttpServletRequest request)
/* 24: */ {
/* 25:37 */ Subject subject = SecurityUtils.getSubject();
/* 26:38 */ UsernamePasswordToken token = new UsernamePasswordToken(blogger.getUserName(), CryptographyUtil.md5(blogger.getPassword(), "darryl"));
/* 27: */ try
/* 28: */ {
/* 29:40 */ subject.login(token);
/* 30:41 */ return "redirect:/admin/main.jsp";
/* 31: */ }
/* 32: */ catch (Exception e)
/* 33: */ {
/* 34:43 */ e.printStackTrace();
/* 35:44 */ request.setAttribute("blogger", blogger);
/* 36:45 */ request.setAttribute("errorInfo", "用户名或密码错误!");
/* 37: */ }
/* 38:46 */ return "login";
/* 39: */ }
/* 40: */
/* 41: */ @RequestMapping({"/aboutMe"})
/* 42: */ public ModelAndView aboutMe()
/* 43: */ throws Exception
/* 44: */ {
/* 45:57 */ ModelAndView mav = new ModelAndView();
/* 46:58 */ mav.addObject("blogger", this.bloggerService.find());
/* 47:59 */ mav.addObject("mainPage", "foreground/blogger/info.jsp");
/* 48:60 */ mav.addObject("pageTitle", "关于博主_Java开源博客系统");
/* 49:61 */ mav.setViewName("mainTemp");
/* 50:62 */ return mav;
/* 51: */ }
/* 52: */ }



/* Location: D:\classes\

* Qualified Name: com.blog.controller.BloggerController

* JD-Core Version: 0.7.0.1

*/
/* 1: */ package com.blog.util;
/* 2: */


项目链接:
https://javayms.github.io?id=401122512008200mx
https://javayms.pages.dev?id=401122512008200mx