Using the Form-Based authentication in Java EE to secure a web application, we can specify a login and and error html page. http://docs.oracle.com/javaee/5/tutorial/doc/bncbe.html
Example:
<login-config>
<auth-method>FORM</auth-method>
<realm-name>file</realm-name>
<form-login-config>
<form-login-page>/logon.jsp</form-login-page>
<form-error-page>/logonError.jsp</form-error-page>
</form-login-config>
</login-config>
Using the HTTP Basic authentication, we cannot specify a login page because it is the responsability of the client web browser to get the login/pwd of the user (typically using a pop-up).
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
However, we would still need to specify an error page. Is that possible? how? that is, using HTTP-Basic authentication (and Java EE), we would need to show a specific error page if the login/pwd provided are incorrect (as in the Form-based authentication).