<%
    // retrieve security principal and store in session
	java.security.Principal principal = request.getUserPrincipal();
	if (principal != null)
	{
		String userName = principal.getName();
		session.setAttribute ( "username", userName );
	}
	else
	{
    		out.println("No principal");
		return;
	}
%>

******************************************************************************

// retrieve username information
HttpSession session = request.getSession();
user = (String)session.getAttribute ( "username" );
if ( user == null )
    mapstr = "not-loggedin";

******************************************************************************

<security-role>
    <role-name>registeredUser</role-name>
</security-role>                        

******************************************************************************

<login-config>
    <auth-method>BASIC</auth-method>
</login-config>            

******************************************************************************

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Add Comments</web-resource-name>
        <url-pattern>/LoggedIn.jsp</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>registeredUser</role-name>
        <role-name>administrator</role-name>
    </auth-constraint>
</security-constraint>

******************************************************************************

