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 52 53 54
| map.put("nlist", list); map.put("nlist2", nlist2); map.put("glist", glist); return "index2"; }
@RequestMapping("showNews.do") public String showNews(ModelMap map, int id) { map.put("news", newsService.getById(id)); return "newsx"; }
@RequestMapping("searchNews.do") public String searchNews(@RequestParam(value = "page", required = false) String page, ModelMap map, HttpSession session, News news) { if (page == null || page.equals("")) { page = "1"; } PageBean pageBean = new PageBean(Integer.parseInt(page), PageBean.PAGESIZE); Map<String, Object> pmap = new HashMap<String, Object>(); Map<String, Object> nmap = new HashMap<String, Object>(); pmap.put("pageno", pageBean.getStart()); pmap.put("pageSize", pageBean.getPageSize()); if (news.getName() != null && !news.getName().equals("")) { pmap.put("name", news.getName()); nmap.put("name", news.getName()); } int total = newsService.getCount(nmap); System.out.println("total===" + total); pageBean.setTotal(total); List<News> list = newsService.getAll(pmap); map.put("page", pageBean); map.put("list", list); session.setAttribute("p", 2); return "newsList"; }
@RequestMapping("newsListFore.do") public String newsListFore(@RequestParam(value = "page", required = false) String page, ModelMap map, HttpSession session) { if (page == null || page.equals("")) { page = "1"; } PageBean pageBean = new PageBean(Integer.parseInt(page), PageBean.PAGESIZE); Map<String, Object> pmap = new HashMap<String, Object>(); pmap.put("pageno", pageBean.getStart()); pmap.put("pageSize", pageBean.getPageSize()); int total = newsService.getCount(null); System.out.println("total===" + total); pageBean.setTotal(total); List<News> list = newsService.getByPage(pmap);
|