You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Zoran Avtarovski <zo...@conads.com> on 2004/10/07 13:32:42 UTC

OT: jstl equivalent of logic:present

I'm trying to find a way to use the isUserInRole method with the c:if tag.

I tried <c:if test="${pageContext.getRequest().isUserInRole("admin")}">

But you can't use the isUserInRole method as an expression. I'd rather not
have to cast the role into a page context string to test. Using the
logic:present tag is more preferable. I only ask because I get the feeling
that there's a move away from the struts tags and toward jstl.

How do others do it?

Zoran



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


Re: OT: jstl equivalent of logic:present

Posted by Craig McClanahan <cr...@gmail.com>.
On Sat, 09 Oct 2004 11:39:41 +1000, Zoran Avtarovski <zo...@conads.com> wrote:
> Thanks guys,
> 
> In the end I stuck with the logic tag. But I do think this highlights a
> deficiency in the JSTL tags.
> 
> Is sun open to suggestions on this topic? I think there is a need for a
> security/authorisation tagset as part of JSTL.

If that is your belief, then the appropriate avenue would be to make
sure that the expert group responsible for JSTL hears about it.  In
turn, that is made possible through a feedback email alias for each
spec document -- for JSTL it is:

  jsr-52-comments@jcp.org

Craig

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


Re: OT: jstl equivalent of logic:present

Posted by Zoran Avtarovski <zo...@conads.com>.
Thanks guys,

In the end I stuck with the logic tag. But I do think this highlights a
deficiency in the JSTL tags.

Is sun open to suggestions on this topic? I think there is a need for a
security/authorisation tagset as part of JSTL.

Zoran

> I couldn't find a way in JSTL/EL using the standard tags.  So it looks
> like we need a tag with that ability.
> In that case it probably doesn't matter if you use the logic tag or the
> other suggestion of the request tag.
> 
> I see that the logic tag allows you to check for more than 1 role eg
> 
> <logic:present role="role1,role2,role3">
> 
> whereas the request tag does not, so there may be a benefit with still
> using the logic tag.
> 
> Zoran Avtarovski wrote:
> 
>> I'm trying to find a way to use the isUserInRole method with the c:if tag.
>> 
>> I tried <c:if test="${pageContext.getRequest().isUserInRole("admin")}">
>> 
>> But you can't use the isUserInRole method as an expression. I'd rather not
>> have to cast the role into a page context string to test. Using the
>> logic:present tag is more preferable. I only ask because I get the feeling
>> that there's a move away from the struts tags and toward jstl.
>> 
>> How do others do it?
>> 
>> Zoran
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
>>  
>> 
> 



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


Re: OT: jstl equivalent of logic:present

Posted by Jason Lea <ja...@kumachan.net.nz>.
I couldn't find a way in JSTL/EL using the standard tags.  So it looks 
like we need a tag with that ability.
In that case it probably doesn't matter if you use the logic tag or the 
other suggestion of the request tag.

I see that the logic tag allows you to check for more than 1 role eg

<logic:present role="role1,role2,role3">

whereas the request tag does not, so there may be a benefit with still 
using the logic tag.

Zoran Avtarovski wrote:

>I'm trying to find a way to use the isUserInRole method with the c:if tag.
>
>I tried <c:if test="${pageContext.getRequest().isUserInRole("admin")}">
>
>But you can't use the isUserInRole method as an expression. I'd rather not
>have to cast the role into a page context string to test. Using the
>logic:present tag is more preferable. I only ask because I get the feeling
>that there's a move away from the struts tags and toward jstl.
>
>How do others do it?
>
>Zoran
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>


-- 
Jason Lea



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


Re: OT: jstl equivalent of logic:present

Posted by Tim Penhey <ti...@penhey.net>.
Zoran Avtarovski wrote:

>I'm trying to find a way to use the isUserInRole method with the c:if tag.
>
>I tried <c:if test="${pageContext.getRequest().isUserInRole("admin")}">
>
>But you can't use the isUserInRole method as an expression. I'd rather not
>have to cast the role into a page context string to test. Using the
>logic:present tag is more preferable. I only ask because I get the feeling
>that there's a move away from the struts tags and toward jstl.
>
>How do others do it?
>
>Zoran
>  
>
Try the request taglib from jakarta...

<%@ taglib uri="http://jakarta.apache.org/taglibs/request-1.0" 
prefix="request"%>

<request:isUserInRole role="admin">
Do admin stuff
</request:isUserInRole>

Tim


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