博客编写功能设计(个人博客)
博客编写功能设计(个人博客)
一、编写dao层
二、绑定mapper配置文件
三、编写service层
四、编写controller层
@RequestMapping("/admin/toWrite") public String toWrite(Model model){ List<Category> categories = categoryService.allCategories(); model.addAttribute("types",categories); model.addAttribute("article", new Article()); return "admin/blogs-input"; }
五、绑定前端页面
主要是插入markdown编辑器,详情见开始页面其他栏目 注意下拉框值的传递用法
<div class="ui left labeled action input"> <label class="ui teal basic compact label">分类</label> <div class="ui fluid selection dropdown"> <input type="hidden" name="categoryId" th:value="*{categoryId}"> <i class="dropdown icon"></i> <div class="default text">分类</div> <div class="menu"> <div th:each="type : ${types}" class="item" th:data-value="${type.statusId}" th:text="${type.name}">我的故事</div> </div> </div> </div>