You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Jim Kennedy <ji...@gigaheads.com> on 2003/06/25 21:58:11 UTC
JSTL and isUserInRole
Has anyone tried this using pure JSTL or Struts. No rt.
I need to do something like this in JSP's
<c:if test="${pageContext.request.userInRole('foo') == true}" >
...
</c:if>
The above does not work. How can I do this? isUserInRole(String) is the
method I need to call. Or maybe there is another way around this. I want
to be able to show content conditionally on the j2ee role.
Jim Kennedy
IT Consultant
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: JSTL and isUserInRole
Posted by Serge Knystautas <se...@lokitech.com>.
Jim Kennedy wrote:
> Has anyone tried this using pure JSTL or Struts. No rt.
>
> I need to do something like this in JSP's
>
> <c:if test="${pageContext.request.userInRole('foo') == true}" >
EL doesn't support method evaluation, so yeah that won't work.
You can just create a simple tag on your own to do this. As part of our
company's core taglib we have.
<loki:inrole role="foo">
</loki:inrole>
So it only evaluates that if the user has that role. You can then
extend it as you need. Maybe the next release of the JSTL will add a
taglib that addresses security, but for right now, you're free to build
it however you want.
--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org