@RequestMapping("/{year:[0-9]+}/{month:[0-9]+}/page/{page:[0-9]+}")
public ModelAndView getArchiveByYearMonth(@PathVariable int year,
@Valid @Min(1) @Max(12) @PathVariable int month,
@PathVariable int page) {
LOGGER.debug("Getting the archive, year={}, month={}, page={}", year, month, page);
// should not be needed in 4.1+
if (month < 1 || month > 12) {
return new ModelAndView("error", null);
}
ModelMap model = new ModelMap();
model.addAttribute("posts", documentService.getRecentByYearMonth(year, month, page - 1, NUM_PER_PAGE));
model.addAttribute("count", documentService.getCountByYearMonth(year, month));
model.addAttribute("year", String.valueOf(year));
model.addAttribute("month", String.format("%02d", month));
LOGGER.trace("Generated model={}", model);
return new ModelAndView("archive_year_month", model);
}
BlogController.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:akanke
作者:
评论列表
文章目录