Java tutorial
/* * Copyright 2005-2013 shopxx.net. All rights reserved. * Support: http://www.shopxx.net * License: http://www.shopxx.net/license */ package net.groupbuy.controller.admin; import javax.annotation.Resource; import net.groupbuy.Pageable; import net.groupbuy.entity.Seo; import net.groupbuy.service.SeoService; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; /** * Controller - SEO * * @author SHOP++ Team * @version 3.0 */ @Controller("adminSeoController") @RequestMapping("/admin/seo") public class SeoController extends BaseController { @Resource(name = "seoServiceImpl") private SeoService seoService; /** * */ @RequestMapping(value = "/edit", method = RequestMethod.GET) public String edit(Long id, ModelMap model) { model.addAttribute("seo", seoService.find(id)); return "/admin/seo/edit"; } /** * */ @RequestMapping(value = "/update", method = RequestMethod.POST) public String update(Seo seo, RedirectAttributes redirectAttributes) { if (!isValid(seo)) { return ERROR_VIEW; } seoService.update(seo, "type"); addFlashMessage(redirectAttributes, SUCCESS_MESSAGE); return "redirect:list.jhtml"; } /** * */ @RequestMapping(value = "/list", method = RequestMethod.GET) public String list(Pageable pageable, ModelMap model) { model.addAttribute("page", seoService.findPage(pageable)); return "/admin/seo/list"; } }