package com.lance.freemaker.web.site;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class IndexController {

	@RequestMapping(value={"","/","index"})
	public String index() {
		return "site/index.jsp";
	}
}

@@ -43,253 +43,1348 @@
 ort 
-org.springframework.stereotype.Controller;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0A%0A@Controller%0Apublic class IndexController %7B%0A%0A%09@RequestMapping(value=%7B%22%22,%22/%22,%22index%22%7D)%0A%09public String index() %7B%0A%09%09return %22site/index.jsp%22;%0A%09%7D%0A%7D%0A
+javax.servlet.http.HttpServletRequest;%0A%0Aimport org.apache.commons.lang3.StringUtils;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.ui.Model;%0Aimport org.springframework.web.bind.annotation.PathVariable;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0A%0Aimport com.lance.freemaker.domain.NewsInfo;%0Aimport com.lance.freemaker.domain.PageInfo;%0Aimport com.lance.freemaker.service.NewService;%0A%0A@Controller%0Apublic class IndexController %7B%0A%09@Autowired%0A%09private NewService newService;%0A%0A%09/**%0A%09 * Index%0A%09 * @param model%0A%09 * @param request%0A%09 */%0A%09@RequestMapping(value=%7B%22%22,%22/%22,%22index%22%7D)%0A%09public String index(Model model, HttpServletRequest request) %7B%0A%09%09String page = request.getParameter(%22page%22);%0A%09%09page = StringUtils.defaultIfBlank(page, %221%22);%0A%09%09int pageNumber = Integer.valueOf(page);%0A%09%09%0A%09%09int total = newService.findCount();%0A%09%09PageInfo%3CNewsInfo%3E pageInfo = new PageInfo%3C%3E(total, pageNumber);%0A%09%09pageInfo.setList(newService.findAll(pageInfo.getPageStart()));%0A%09%09%0A%09%09model.addAttribute(%22page%22, pageInfo);%0A%09%09return %22index%22;%0A%09%7D%0A%09%0A%09/**%0A%09 * Detail%0A%09 * @param model%0A%09 * @param id%0A%09 */%0A%09@RequestMapping(%22detail/%7Bid%7D%22)%0A%09public String detail(Model model, @PathVariable int id) %7B%09%09%0A%09%09model.addAttribute(%22detail%22, newService.findOne(id));%0A%09%09return %22detail%22;%0A%09%7D%0A%7D

update index controller ftl