struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "McDonnell, Colm (MLIM)" <colm_mcdonn...@ml.com>
Subject RE: [OT] how to test user role in jsp
Date Tue, 03 May 2005 15:38:48 GMT
The Struts logic tags will do this

<logic:present role="YOUR_ROLE_NAME_HERE">
    <a href="#foo">foo</a>
</logic:present>

If the current user has the named role (as determined by calling request.isUserInRole(...))
then the conditional markup will be rendered.

I don't know whether you can do this using JSTL, I don't think this would work:

<c:if test=${request.isUserInRole('YOUR_ROLE_NAME_HERE')}>

But perhaps you could access the roles array within the principal (within the request)?


-----Original Message-----
From: Günther Wieser [mailto:gwieser@creative-it.com] 
Sent: 03 May 2005 15:44
To: 'Struts Users Mailing List'
Subject: [OT] how to test user role in jsp


hi,

sorry for posting something that's very likely not really related to struts
(but maybe it is, who knows), but coudn't find anything on the net.

i would like to display a link depending if a user is in a certain role. is
there a test i could use in <c:if test=${...}> or anything else i could use
as a tag to do this? do i need to implement this on my own?

kr,
guenther

--
Günther Wieser

creative-it
Guglgasse 6/1/11/1
A-1110 Wien
Austria
http://www.creative-it.com
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the sender, delete it and
do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important
additional terms relating to this e-mail.     http://www.ml.com/email_terms/
--------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message