<%@page errorPage="oops.jsp" import="java.util.*,jabadot.*" %> <% User user = (User)session.getAttribute("jabadot.login"); if (user == null) { %> You're not logged on!

You're not logged on!

So you can't log out!

You may want to log in now, or create your own account.

<% return; } // else we were logged in, so log out // Destroy references to the User object. session.removeAttribute("jabadot.login"); // Destroy the session object itself. // session.invalidate(); // NO DON'T! We need it to send the message below. // It suffices to removeAttribute() the User object... session.setAttribute("jabadot.message", "

Logged out

You have been logged out, as you requested

"); // But do remove from global user list too TreeMap list = (TreeMap)application.getAttribute("jabadot.wtmp"); if (list == null) { log("Heh!? Logging user out but jabadot.wtmp does not exist"); } // Warning - if list admin removes you while you are logged in, // this will throw a nullpointer exception. Probably rare enough // that it's not worth fixing. Administrators: be warned. list.remove(user.getName()); response.sendRedirect("/jabadot/"); %> Logged out

Logged out

Thank you, and come back again soon.