Just add this to your web.xml:
<login-config> <auth-method>FORM</auth-method> <realm-name>myrealm</realm-name> <form-login-config> <form-login-page>login</form-login-page> <form-error-page>loginfailed</form-error-page> </form-login-config> </login-config>
Your form needs to have these inputs and action:
<form method="POST" action="j_security_check" > <input type="text" name="j_username" > <input type="password" name="j_password" > </form>