package util; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class SessionTool { private HttpServletRequest request; private HttpServletResponse response; public SessionTool(HttpServletRequest request, HttpServletResponse response){ super(); this.request = request; this.response = response; } public void saveSession(String sessionName,Object sessionValue){ request.getSession().setAttribute(sessionName, sessionValue); } public Object getSession(String sessionName){ return request.getSession().getAttribute(sessionName); } public void deleteSession(String sessionName){ request.getSession().removeAttribute(sessionName); } }