简介
个人博客系统主要用于发表个人博客,记录个人生活日常,学习心得,技术分享等,供他人浏览,查阅,评论等。
本系统结构如下:
(1)博主端:
登录模块:
登入后台管理系统:首先进入登录页面,需要输入账号和密码。它会使用Shiro进行安全管理,对前台输入的密码进行加密运算,然后与数据库中的进行比较。成功后才能登入后台系统。
博客管理模块:
博客管理功能分为写博客和博客信息管理。写博客是博主用来发表编写博客的,需要博客标题,然后选择博客类型,最后将博客内容填入百度的富文本编辑器中,点击发布博客按钮即可发布博客。
博客类别管理模块:
博主类别管理系统可以添加,修改和删除博客类型名称和排序序号。将会显示到首页的按日志类别区域。游客可以从这里查找相关的感兴趣的博客内容
评论信息管理模块:
评论管理功能分为评论审核和评论信息管理两部分。评论审核是当有游客或自己发表了评论之后,博主需
要在后台管理系统中审核评论。若想将此评论显示在页面上则点击审核通过,否则点击审核不通过。
个人信息管理模块:修改博主的个人信息,可以修改昵称,个性签名,可以添加个人头像,修改个人简介;
系统管理功能模块:友情链接管理,修改密码,刷新系统缓存和安全退出,友情链接管理可以添加,修改,删除友情链接网址
(2)游客端:
- 查询博客: 查询具体哪一篇博客
- 查看博客内容: 查看博客内容
- 查看博主个人信息:查看博主个人简介
- 发表评论: 可以评论具体某篇博客
- 友情链接: 查看友情链接
项目截图:
使用shiro框架进行权限校验:
通过自定义MyRealm类 继承AuthorizingRealm 实现权限校验。
public class MyRealm extends AuthorizingRealm {
@Resource
private BloggerService bloggerService;
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
return null;
}
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
throws AuthenticationException {
String userName = (String) token.getPrincipal();
Blogger blogger = this.bloggerService.getByUserName(userName);
if (blogger != null) {
SecurityUtils.getSubject().getSession().setAttribute("currentUser", blogger);
AuthenticationInfo authcInfo = new SimpleAuthenticationInfo(blogger.getUserName(), blogger.getPassword(), "xx");
return authcInfo;
}
return null;
}
}
登陆生成token
@RequestMapping({"/login"})
public String login(Blogger blogger, HttpServletRequest request) {
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(blogger.getUserName(), CryptographyUtil.md5(blogger.getPassword(), "java1234"));
try {
subject.login(token);
return "redirect:/admin/main.jsp";
} catch (Exception e) {
e.printStackTrace();
request.setAttribute("blogger", blogger);
request.setAttribute("errorInfo", "用户名或密码错误!");
}
return "login";
}
MD5密码加密工具
public class CryptographyUtil {
public static String md5(String str, String salt) {
return new Md5Hash(str, salt).toString();
}
}
配置数据库事务传播
<!-- 配置事务通知属性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<!-- 定义事务传播属性 -->
<tx:attributes>
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="edit*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="new*" propagation="REQUIRED" />
<tx:method name="set*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="change*" propagation="REQUIRED" />
<tx:method name="check*" propagation="REQUIRED" />
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="find*" propagation="REQUIRED" read-only="true" />
<tx:method name="load*" propagation="REQUIRED" read-only="true" />
<tx:method name="*" propagation="REQUIRED" read-only="true" />
</tx:attributes>
</tx:advice>
论文及其他资料:
扫描二维码直接获取
免费的