tags:

views:

143

answers:

1

I need to make decisions in a JSP based on the user's roles. Is there a tag or EL expression that lets me do that?

+1  A: 

There isn't one built into JSP or JSTL, but the request taglib from the Jakarta project provides an isUserInRole tag. Install the taglib, and use the tag like this:

<req:isUserInRole role="admin">
 The remote user is in role "admin".
</req:isUserInRole>
<req:isUserInRole role="admin" value="false">
 The remote user is not in role "admin".
</req:isUserInRole>
Sietse