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.shop; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import net.groupbuy.entity.Member; import net.groupbuy.util.WebUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * Controller - * * @author SHOP++ Team * @version 3.0 */ @Controller("shopLogoutController") public class LogoutController extends BaseController { /** * */ @RequestMapping(value = "/logout", method = RequestMethod.GET) public String execute(HttpServletRequest request, HttpServletResponse response, HttpSession session) { session.removeAttribute(Member.PRINCIPAL_ATTRIBUTE_NAME); WebUtils.removeCookie(request, response, Member.USERNAME_COOKIE_NAME); return "redirect:/"; } }