Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package edu.pitt.sis.infsci2730.finalProject.web; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * * @author Wu */ @Controller @RequestMapping("/logout") public class LogoutController { @RequestMapping(value = "", method = RequestMethod.GET) public void logout(HttpServletResponse res, HttpSession session) { session.invalidate(); try { res.sendRedirect("/eBusiness/user"); } catch (IOException ex) { Logger.getLogger(LogoutController.class.getName()).log(Level.SEVERE, null, ex); } } }