// 前台展示内容 public String showContent() throws Exception { entity = dao.get(entity.getId()); // 判断,若为null,则为第一次点击 if (entity.getClicknumber() == null) { entity.setClicknumber(0); } // 阅读量+1 entity.setClicknumber(entity.getClicknumber() + 1); // 更新阅读量 dao.update(entity); return "news-show"; }
// 后台查询新闻 public String searchNews() throws Exception { xwlist = dao.searchByTD(entity.getTitle(), entity.getPubdate()); return "news-admin"; }
// 后台删除新闻 public String deleteNews() throws Exception { dao.delete(entity.getId()); return "save-admin"; }
// 后台修改新闻 public String getNews() throws Exception { entity = dao.get(entity.getId()); return "news-admin-input"; }