<%-- Written by Sukhwinder Singh (ssruprai@hotmail.com --%> <%@ page import="chat.*" errorPage="error.jsp" %> You have logged out <%@ include file="header.jsp" %>
<% String nickname = (String)session.getAttribute("nickname"); if (nickname != null && nickname.length() > 0) { ChatRoomList roomList = (ChatRoomList) application.getAttribute("chatroomlist"); // this is always the main room ChatRoom chatRoom = roomList.getRoomOfChatter(nickname); if (chatRoom != null) { chatRoom.addMessage(new Message("system", nickname + " has logged out.", new java.util.Date().getTime())); chatRoom.removeChatter(nickname); session.invalidate(); out.write("You successfully logged out
"); out.write("Login again"); } else { response.sendRedirect("login.jsp"); } } else { response.sendRedirect("login.jsp"); } %>