——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明





基于javaweb的SSM个人博客系统(java+ssm+mysql+jsp)
前台访问地址:http://localhost:8080/boke/index.do
zhangsan 123456
lisi 123456
wangwu 123456
zhaoliu 123456
sunqi 123456
后台访问地址:http://localhost:8080/boke/admin/login.jsp
admin 123456
——————————CodeStart——————————
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
|
@RequestMapping(value = "/tadmin_add") public String add(Tadmin tadmin, HttpServletRequest request) throws Exception { tadminService.insertTadmin(tadmin); return "redirect:tadmin_list.action"; }
@RequestMapping(value = "/tadmin_toUpdate") public String toUpdate(HttpServletRequest request) throws Exception { int id = Integer.parseInt(request.getParameter("id")); Tadmin tadmin = tadminService.queryTadminById(id); request.setAttribute("tadmin", tadmin); return "/admin/tadmin/tadmin_update.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
|
@RequestMapping(value = "/blogtype_add") public String add(Blogtype blogtype, HttpServletRequest request) throws Exception { blogtypeService.insertBlogtype(blogtype); return "redirect:blogtype_list.action"; }
@RequestMapping(value = "/blogtype_toUpdate") public String toUpdate(HttpServletRequest request) throws Exception { int id = Integer.parseInt(request.getParameter("id")); Blogtype blogtype = blogtypeService.queryBlogtypeById(id); request.setAttribute("blogtype", blogtype); return "/admin/blogtype/blogtype_update.jsp"; }
@RequestMapping(value = "/blogtype_update") public String update(Blogtype blogtype, HttpServletRequest request) throws Exception { blogtypeService.updateBlogtype(blogtype); return "redirect:blogtype_list.action"; }
|
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
| List<Blogtype> blogTypeList = blogTypeService.getBlogTypeData(bid); request.getSession().setAttribute("blogTypeList", blogTypeList);
Blogger blogger = bloggerService.queryBloggerById(bid); request.getSession().setAttribute("blogger", blogger); boolean favbool=false; if(request.getSession().getAttribute("user")!=null){ Blogger user = (Blogger) request.getSession().getAttribute("user"); Fav fav = new Fav(); fav.setBzid(bid); fav.setUid(user.getId()); List<Fav> fs = favService.queryFavList(fav, null); if(fs!=null&&fs.size()>0){ favbool = true; } } modelAndView.addObject("favbool", favbool); return modelAndView;
}
@RequestMapping("/") public String home(HttpServletRequest request) throws Exception {
return "/index";
} }
|
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
|
@Controller public class TagController {
@Autowired private TagService tagService;
@RequestMapping(value = "/tag_list") public String list(HttpServletRequest request) throws Exception {
int offset = 0; int counts = 0; try { offset = Integer.parseInt(request.getParameter("pager.offset")); } catch (Exception e) { } PageBean page = new PageBean(offset); Tag tag = new Tag(); counts = tagService.getCount(tag); List tagList = tagService.queryTagList(tag, page); request.setAttribute("list", tagList); request.setAttribute("itemSize", counts); int page_count = counts % PageBean.PAGE_IETM == 0 ? counts / PageBean.PAGE_IETM : counts / PageBean.PAGE_IETM + 1; request.setAttribute("pageItem", PageBean.PAGE_IETM); request.setAttribute("pageTotal", page_count); return "/admin/tag/tag_list.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
| throws Exception { blogService.updateBlog(blog); return "redirect:blog_list.action"; }
@RequestMapping(value = "/blog_delete") public String delete(HttpServletRequest request) throws Exception { int id = Integer.parseInt(request.getParameter("id")); blogService.deleteBlog(id); return "redirect:blog_list.action"; }
@RequestMapping(value = "/blog_toView") public String toView(HttpServletRequest request) throws Exception { int id = Integer.parseInt(request.getParameter("id")); Blog blog = new Blog(); blog.setId(id); List<Blog> list = blogService.queryBlogList(blog, null); blog = list.get(0); request.setAttribute("blog", blog); return "/admin/blog/blog_view.jsp"; } }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=031823562708201cc
https://javayms.pages.dev?id=031823562708201cc