I want to show/hide links in a page based on the role that an authenticated
user is in.  Is it possible to write the following with a TagLib?

<%@page contentType="text/html"%>
<%@page import="java.security.Principal" %>
<html>
<head><title>JSP Page</title></head>
<body>

<%
  Principal principal = request.getUserPrincipal();
  if( principal == null ) {
%>
There is no user principal (null)<p>
<%
  } else {
%>
User Principal is: <%= principal.getName() %>
<%
  }
%>
<P>Auth type is: <%= request.getAuthType() %>
<P>Request is secure: <%= request.isSecure() %>
<P>User is in role1: <%= request.isUserInRole("role1") %>
<P>User is in role2: <%= request.isUserInRole("role2") %>
<P>User is in Employee: <%= request.isUserInRole("Employee") %>
</body>
</html>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to