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

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

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于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/ 登录
/*  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:    */ 
/* 46:57 */       List<String> imagesList = blog.getImagesList();
/* 47:58 */       String blogInfo = blog.getContent();
/* 48:59 */       Document doc = Jsoup.parse(blogInfo);
/* 49:60 */       Elements jpgs = doc.select("img[src$=.jpg]");
/* 50:61 */       for (int i = 0; i < jpgs.size(); i++)
/* 51:   */       {
/* 52:62 */         Element jpg = (Element)jpgs.get(i);
/* 53:63 */         imagesList.add(jpg.toString());
/* 54:64 */         if (i == 2) {
/* 55:   */           break;
/* 56:   */         }
/* 57:   */       }
/* 58:   */     }
/* 59:69 */     mav.addObject("blogList", blogList);
/* 60:70 */     StringBuffer param = new StringBuffer();
/* 61:71 */     if (StringUtil.isNotEmpty(typeId)) {
/* 62:72 */       param.append("typeId=" + typeId + "&");
/* 63:   */     }
/* 64:74 */     if (StringUtil.isNotEmpty(releaseDateStr)) {
/* 65:75 */       param.append("releaseDateStr=" + releaseDateStr + "&");
/* 66:   */     }
/* 67:77 */     mav.addObject("pageCode", PageUtil.genPagination(request.getContextPath() + "/index.html", this.blogService.getTotal(map).longValue(), Integer.parseInt(page), 10, param.toString()));
/* 68:78 */     mav.addObject("mainPage", "foreground/blog/list.jsp");
/* 69:79 */     mav.addObject("pageTitle", "Java个人博客系统");
/* 70:80 */     mav.setViewName("mainTemp");
/* 71:81 */     return mav;
/* 72:   */   }
/* 73:   */   
/* 74:   */   @RequestMapping({"/download"})
/* 75:   */   public ModelAndView download()
/* 76:   */     throws Exception
/* 77:   */   {
/* 78:91 */     ModelAndView mav = new ModelAndView();
/* 79:92 */     mav.addObject("mainPage", "foreground/system/download.jsp");
/* 80:93 */     mav.addObject("pageTitle", "本站源码下载页面_Java开源博客系统");
/* 81:94 */     mav.setViewName("mainTemp");
/* 82:95 */     return mav;
/* 83:   */   }
/* 84:   */ }

/* Location:           D:\classes\

 * Qualified Name:     com.blog.controller.IndexController

  public ModelAndView search(@RequestParam(value="q", required=false) String q, @RequestParam(value="page", required=false) String page, HttpServletRequest request)
          throws Exception
  {
    if (StringUtil.isEmpty(page)) {
      page = "1";
    }
    ModelAndView mav = new ModelAndView();
    mav.addObject("mainPage", "foreground/blog/result.jsp");
    Map<String, Object> map = new HashMap<>();
    map.put("title",q);
    map.put("content",q);
    List<Blog> blogList = blogService.list(map);
    Integer toIndex = Integer.valueOf(blogList.size() >= Integer.parseInt(page) * 10 ? Integer.parseInt(page) * 10 : blogList.size());
    mav.addObject("blogList", blogList.subList((Integer.parseInt(page) - 1) * 10, toIndex.intValue()));
    mav.addObject("pageCode", genUpAndDownPageCode(Integer.valueOf(Integer.parseInt(page)), Integer.valueOf(blogList.size()), q, Integer.valueOf(10), request.getServletContext().getContextPath()));
    mav.addObject("q", q);
    mav.addObject("resultTotal", Integer.valueOf(blogList.size()));
    mav.addObject("pageTitle", "搜索关键字'" + q + "'结果页面_Java开源博客系统");
    mav.setViewName("mainTemp");
    return mav;
  }

  private String genUpAndDownPageCode(Blog lastBlog, Blog nextBlog, String projectContext)
  {
    StringBuffer pageCode = new StringBuffer();
    if ((lastBlog == null) || (lastBlog.getId() == null)) {
      pageCode.append("<p>上一篇:没有了</p>");
    } else {
      pageCode.append("<p>上一篇:<a href='" + projectContext + "/blog/articles/" + lastBlog.getId() + ".html'>" + lastBlog.getTitle() + "</a></p>");
    }
    if ((nextBlog == null) || (nextBlog.getId() == null)) {
      pageCode.append("<p>下一篇:没有了</p>");
    } else {
      pageCode.append("<p>下一篇:<a href='" + projectContext + "/blog/articles/" + nextBlog.getId() + ".html'>" + nextBlog.getTitle() + "</a></p>");
    }
    return pageCode.toString();
  }

  private String genUpAndDownPageCode(Integer page, Integer totalNum, String q, Integer pageSize, String projectContext)
  {
    long totalPage = totalNum.intValue() % pageSize.intValue() == 0 ? totalNum.intValue() / pageSize.intValue() : totalNum.intValue() / pageSize.intValue() + 1;
    StringBuffer pageCode = new StringBuffer();
    if (totalPage == 0L) {
      return "";
    }
    pageCode.append("<nav>");
    pageCode.append("<ul class='pager' >");
    if (page.intValue() > 1) {
      pageCode.append("<li><a href='" + projectContext + "/blog/q.html?page=" + (page.intValue() - 1) + "&q=" + q + "'>上一页</a></li>");
    } else {
      pageCode.append("<li class='disabled'><a href='#'>上一页</a></li>");
/* 51:71 */       resultTotal = this.linkService.update(link);
/* 52:   */     }
/* 53:73 */     JSONObject result = new JSONObject();
/* 54:74 */     if (resultTotal > 0) {
/* 55:75 */       result.put("success", Boolean.valueOf(true));
/* 56:   */     } else {
/* 57:77 */       result.put("success", Boolean.valueOf(false));
/* 58:   */     }
/* 59:79 */     ResponseUtil.write(response, result);
/* 60:80 */     return null;
/* 61:   */   }
/* 62:   */   
/* 63:   */   @RequestMapping({"/delete"})
/* 64:   */   public String delete(@RequestParam("ids") String ids, HttpServletResponse response)
/* 65:   */     throws Exception
/* 66:   */   {
/* 67:92 */     String[] idsStr = ids.split(",");
/* 68:93 */     for (int i = 0; i < idsStr.length; i++) {
/* 69:94 */       this.linkService.delete(Integer.valueOf(Integer.parseInt(idsStr[i])));
/* 70:   */     }
/* 71:96 */     JSONObject result = new JSONObject();
/* 72:97 */     result.put("success", Boolean.valueOf(true));
/* 73:98 */     ResponseUtil.write(response, result);
/* 74:99 */     return null;
/* 75:   */   }
/* 76:   */ }

/* Location:           D:\classes\

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

 * JD-Core Version:    0.7.0.1

 */
/*  1:   */ package com.blog.controller.admin;
/*  2:   */ 
/*  19:    */ @Controller
/*  20:    */ @RequestMapping({"/admin/blogType"})
/*  21:    */ public class BlogTypeAdminController
/*  22:    */ {
/*  23:    */   @Resource
/*  24:    */   private BlogTypeService blogTypeService;
/*  25:    */   @Resource
/*  26:    */   private BlogService blogService;
/*  27:    */   
/*  28:    */   @RequestMapping({"/list"})
/*  29:    */   public String list(@RequestParam(value="page", required=false) String page, @RequestParam(value="rows", required=false) String rows, HttpServletResponse response)
/*  30:    */     throws Exception
/*  31:    */   {
/*  32: 48 */     PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
/*  33: 49 */     Map<String, Object> map = new HashMap();
/*  34: 50 */     map.put("start", Integer.valueOf(pageBean.getStart()));
/*  35: 51 */     map.put("size", Integer.valueOf(pageBean.getPageSize()));
/*  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 {
/*  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);
/*  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);
/* 78:91 */     ModelAndView mav = new ModelAndView();
/* 79:92 */     mav.addObject("mainPage", "foreground/system/download.jsp");
/* 80:93 */     mav.addObject("pageTitle", "本站源码下载页面_Java开源博客系统");
/* 81:94 */     mav.setViewName("mainTemp");
/* 82:95 */     return mav;
/* 83:   */   }
/* 84:   */ }

/* Location:           D:\classes\

 * Qualified Name:     com.blog.controller.IndexController

 * JD-Core Version:    0.7.0.1

 */
/*   1:    */ package com.blog.controller.admin;
/*   2:    */ 
/*  19:    */ 
/*  20:    */ @Controller
/*  21:    */ @RequestMapping({"/admin/comment"})
/*  22:    */ public class CommentAdminController
/*  23:    */ {
/*  24:    */   @Resource
/*  25:    */   private CommentService commentService;

 */
/*   1:    */ package com.blog.controller.admin;
/*   2:    */ 
/*  19:    */ 
/*  20:    */ @Controller
/*  21:    */ @RequestMapping({"/admin/comment"})
/*  22:    */ public class CommentAdminController
/*  23:    */ {
/*  24:    */   @Resource
/*  25:    */   private CommentService commentService;
/*  26:    */   
/*  27:    */   @RequestMapping({"/list"})
/*  28:    */   public String list(@RequestParam(value="page", required=false) String page, @RequestParam(value="rows", required=false) String rows, @RequestParam(value="state", required=false) String state, HttpServletResponse response)
/*  29:    */     throws Exception
/*  30:    */   {
/*  31: 45 */     PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
/*  32: 46 */     Map<String, Object> map = new HashMap();
/*  33: 47 */     map.put("start", Integer.valueOf(pageBean.getStart()));
/*  34: 48 */     map.put("size", Integer.valueOf(pageBean.getPageSize()));
/*  35: 49 */     map.put("state", state);
/*  36: 50 */     List<Comment> commentList = this.commentService.list(map);
/*  37: 51 */     Long total = this.commentService.getTotal(map);
/*  38: 52 */     JSONObject result = new JSONObject();
/*  70: 91 */     result.put("rows", jsonArray);
/*  71: 92 */     result.put("total", total);
/*  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:    */ 
  }

  @RequestMapping({"/q"})
  public ModelAndView search(@RequestParam(value="q", required=false) String q, @RequestParam(value="page", required=false) String page, HttpServletRequest request)
          throws Exception
  {
    if (StringUtil.isEmpty(page)) {
      page = "1";
    }
    ModelAndView mav = new ModelAndView();
    mav.addObject("mainPage", "foreground/blog/result.jsp");
    Map<String, Object> map = new HashMap<>();
    map.put("title",q);
    map.put("content",q);
    List<Blog> blogList = blogService.list(map);
    Integer toIndex = Integer.valueOf(blogList.size() >= Integer.parseInt(page) * 10 ? Integer.parseInt(page) * 10 : blogList.size());
    mav.addObject("blogList", blogList.subList((Integer.parseInt(page) - 1) * 10, toIndex.intValue()));
    mav.addObject("pageCode", genUpAndDownPageCode(Integer.valueOf(Integer.parseInt(page)), Integer.valueOf(blogList.size()), q, Integer.valueOf(10), request.getServletContext().getContextPath()));
    mav.addObject("q", q);
    mav.addObject("resultTotal", Integer.valueOf(blogList.size()));
    mav.addObject("pageTitle", "搜索关键字'" + q + "'结果页面_Java开源博客系统");
    mav.setViewName("mainTemp");
    return mav;
  }

  private String genUpAndDownPageCode(Blog lastBlog, Blog nextBlog, String projectContext)
  {
    StringBuffer pageCode = new StringBuffer();
    if ((lastBlog == null) || (lastBlog.getId() == null)) {
      pageCode.append("<p>上一篇:没有了</p>");
    } else {
      pageCode.append("<p>上一篇:<a href='" + projectContext + "/blog/articles/" + lastBlog.getId() + ".html'>" + lastBlog.getTitle() + "</a></p>");
    }
    if ((nextBlog == null) || (nextBlog.getId() == null)) {
      pageCode.append("<p>下一篇:没有了</p>");
    } else {
      pageCode.append("<p>下一篇:<a href='" + projectContext + "/blog/articles/" + nextBlog.getId() + ".html'>" + nextBlog.getTitle() + "</a></p>");
    }
    return pageCode.toString();
  }

  private String genUpAndDownPageCode(Integer page, Integer totalNum, String q, Integer pageSize, String projectContext)
  {
    long totalPage = totalNum.intValue() % pageSize.intValue() == 0 ? totalNum.intValue() / pageSize.intValue() : totalNum.intValue() / pageSize.intValue() + 1;
    StringBuffer pageCode = new StringBuffer();
    if (totalPage == 0L) {
      return "";
    }
    pageCode.append("<nav>");
    pageCode.append("<ul class='pager' >");
    if (page.intValue() > 1) {
      pageCode.append("<li><a href='" + projectContext + "/blog/q.html?page=" + (page.intValue() - 1) + "&q=" + q + "'>上一页</a></li>");
    } else {
      pageCode.append("<li class='disabled'><a href='#'>上一页</a></li>");
/*  57: 76 */     result.put("success", Boolean.valueOf(true));
/*  58: 77 */     ResponseUtil.write(response, result);
/*  59: 78 */     return null;
/*  60:    */   }
/*  61:    */   
/*  62:    */   @RequestMapping({"/review"})
/*  63:    */   public String review(@RequestParam("ids") String ids, @RequestParam("state") Integer state, HttpServletResponse response)
/*  64:    */     throws Exception
/*  65:    */   {
/*  66: 90 */     String[] idsStr = ids.split(",");
/*  67: 91 */     for (int i = 0; i < idsStr.length; i++)
/*  68:    */     {
/*  69: 92 */       Comment comment = new Comment();
/*  70: 93 */       comment.setState(state);
/*  71: 94 */       comment.setId(Integer.valueOf(Integer.parseInt(idsStr[i])));
/*  72: 95 */       this.commentService.update(comment);
/*  73:    */     }
/*  74: 97 */     JSONObject result = new JSONObject();
/*  75: 98 */     result.put("success", Boolean.valueOf(true));
/*  76: 99 */     ResponseUtil.write(response, result);
/*  77:100 */     return null;
/*  78:    */   }
/*  79:    */ }

/* Location:           D:\classes\

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

 * JD-Core Version:    0.7.0.1

 */
/*  1:   */ package com.blog.controller.admin;
/*  2:   */ 
/* 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"})
 */
/*  1:   */ package com.blog.controller;
/*  2:   */ 
/* 14:   */ 
/* 15:   */ @Controller
/* 16:   */ @RequestMapping({"/blogger"})
/* 17:   */ public class BloggerController
/* 18:   */ {
/* 19:   */   @Resource
/* 20:   */   private BloggerService bloggerService;
/* 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

/* Location:           D:\classes\

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

 * JD-Core Version:    0.7.0.1

 */
/*   1:    */ package com.blog.controller.admin;
/*   2:    */ 
/*  18:    */ 
/*  19:    */ @Controller
/*  20:    */ @RequestMapping({"/admin/blogType"})
/*  21:    */ public class BlogTypeAdminController
/*  22:    */ {
/*  23:    */   @Resource
/*  24:    */   private BlogTypeService blogTypeService;
/*  25:    */   @Resource
/*  26:    */   private BlogService blogService;
/*  27:    */   
/*  28:    */   @RequestMapping({"/list"})
/*  29:    */   public String list(@RequestParam(value="page", required=false) String page, @RequestParam(value="rows", required=false) String rows, HttpServletResponse response)
/*  30:    */     throws Exception
/*  31:    */   {
/*  32: 48 */     PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
/*  33: 49 */     Map<String, Object> map = new HashMap();
/*  34: 50 */     map.put("start", Integer.valueOf(pageBean.getStart()));
/*  35: 51 */     map.put("size", Integer.valueOf(pageBean.getPageSize()));
/*  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);
/* 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:   */     }
/* 53:73 */     JSONObject result = new JSONObject();
/* 54:74 */     if (resultTotal > 0) {
/* 55:75 */       result.put("success", Boolean.valueOf(true));
/* 56:   */     } else {
/* 57:77 */       result.put("success", Boolean.valueOf(false));
/* 58:   */     }
/* 59:79 */     ResponseUtil.write(response, result);
/* 60:80 */     return null;
/* 61:   */   }
/* 62:   */   
/* 63:   */   @RequestMapping({"/delete"})
/* 64:   */   public String delete(@RequestParam("ids") String ids, HttpServletResponse response)
/* 65:   */     throws Exception
/* 66:   */   {
/* 67:92 */     String[] idsStr = ids.split(",");
/* 68:93 */     for (int i = 0; i < idsStr.length; i++) {
/* 69:94 */       this.linkService.delete(Integer.valueOf(Integer.parseInt(idsStr[i])));
/* 70:   */     }
/* 71:96 */     JSONObject result = new JSONObject();
/* 72:97 */     result.put("success", Boolean.valueOf(true));
/* 73:98 */     ResponseUtil.write(response, result);
/* 74:99 */     return null;
/* 75:   */   }
/* 76:   */ }

/* Location:           D:\classes\

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

 * JD-Core Version:    0.7.0.1

 */
/*  1:   */ package com.blog.controller.admin;
/* 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:   */     }
/* 53:73 */     JSONObject result = new JSONObject();
/* 54:74 */     if (resultTotal > 0) {
/* 55:75 */       result.put("success", Boolean.valueOf(true));
/* 56:   */     } else {
/* 57:77 */       result.put("success", Boolean.valueOf(false));
/* 58:   */     }
/* 59:79 */     ResponseUtil.write(response, result);
/* 60:80 */     return null;
/* 61:   */   }
/*  2:   */ 
/* 14:   */ 
/* 15:   */ @Controller
/* 16:   */ @RequestMapping({"/blogger"})
/* 17:   */ public class BloggerController
/* 18:   */ {
/* 19:   */   @Resource
/* 20:   */   private BloggerService bloggerService;
/* 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;
      mav.addObject("keyWords", StringUtil.filterWhite(Arrays.asList(arr)));
    }
    else
    {
      mav.addObject("keyWords", null);
    }
    mav.addObject("blog", blog);
    blog.setClickHit(Integer.valueOf(blog.getClickHit().intValue() + 1));
    this.blogService.update(blog);
    Map<String, Object> map = new HashMap();
    map.put("blogId", blog.getId());
    map.put("state", Integer.valueOf(1));
    mav.addObject("commentList", this.commentService.list(map));
    mav.addObject("pageCode", genUpAndDownPageCode(this.blogService.getLastBlog(id), this.blogService.getNextBlog(id), request.getServletContext().getContextPath()));
    mav.addObject("mainPage", "foreground/blog/view.jsp");
    mav.addObject("pageTitle", blog.getTitle() + "_Java开源博客系统");
    mav.setViewName("mainTemp");
    return mav;
  }

  @RequestMapping({"/q"})
  public ModelAndView search(@RequestParam(value="q", required=false) String q, @RequestParam(value="page", required=false) String page, HttpServletRequest request)
          throws Exception
  {
    if (StringUtil.isEmpty(page)) {
      page = "1";
    }
    ModelAndView mav = new ModelAndView();
    mav.addObject("mainPage", "foreground/blog/result.jsp");
    Map<String, Object> map = new HashMap<>();
    map.put("title",q);
    map.put("content",q);
    List<Blog> blogList = blogService.list(map);
    Integer toIndex = Integer.valueOf(blogList.size() >= Integer.parseInt(page) * 10 ? Integer.parseInt(page) * 10 : blogList.size());
    mav.addObject("blogList", blogList.subList((Integer.parseInt(page) - 1) * 10, toIndex.intValue()));
    mav.addObject("pageCode", genUpAndDownPageCode(Integer.valueOf(Integer.parseInt(page)), Integer.valueOf(blogList.size()), q, Integer.valueOf(10), request.getServletContext().getContextPath()));
    mav.addObject("q", q);
    mav.addObject("resultTotal", Integer.valueOf(blogList.size()));
    mav.addObject("pageTitle", "搜索关键字'" + q + "'结果页面_Java开源博客系统");
    mav.setViewName("mainTemp");

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值