/** * 【模板】新闻列表(按时间排序,最新的在最前面) * * @param request * @param response * @return */ @SuppressWarnings({"rawtypes", "unchecked"}) @RequestMapping("/getNewsList") public ModelAndView getNewsList(HttpServletRequest request, HttpServletResponse response) { ModelAndView mv = new ModelAndView(); // 绑定request中请求过来的分页参数 Page page = new Page(); this.dataBinder(page, WebUtils.getParametersStartingWith(request, "")); // 新闻分类ID String newsTypeId = request.getParameter("newsTypeId"); // log.debug("$$$@@:newsTypeId的值为:"+newsTypeId ); if (null == newsTypeId || "".equals(newsTypeId)) { newsTypeId = INewsService.NEWS_TYPE_ID_ALL; // log.debug("$$$@@:newsTypeId isEmpty!" ); } // 最新新闻 List<News> news = newsService.findLatestNews(newsTypeId, page.getPageNum(), page.getPageSize()); PageInfo newsInfo = new PageInfo(news); mv.addObject("news", newsInfo); log.debug("run newsList:[newsTypeId:" + newsTypeId + "]"); log.debug("run newsList ......"); mv.setViewName("/front/modules/newsList"); return mv; }
/** * 【模板】新闻详情页 * * @return */ @RequestMapping("/getNewsDetail") public ModelAndView getNewsDetail(HttpServletRequest request, HttpServletResponse response) { ModelAndView mv = new ModelAndView(); String newsId = request.getParameter("newsId"); News news = newsService.getNewsDetail(newsId); log.debug("run getNewsDetail ......"); mv.addObject("news", news); mv.setViewName("front/modules/newsDetail"); return mv; }