There are two approaches to security in a
Java web app; Declarative and Programmatic.
Containers provide mechanisms for declarative security which allows you to set everything up via configuration scripts (there is a link to the
Servlet Spec in my signature if you want to learn more about it).
With programmatic security (the one I prefer), you write your own.
Rather than
test for a null session (which is very unreliable with apps that use JSP), try adding an object to the user's session after a successful login.
Then, test that object for null instead of the session itself.