You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jeffrey Porter <PO...@WMGMAIL.wmg.warwick.ac.uk> on 2005/10/20 19:45:04 UTC

IF statement..?

 

 

Does MyFaces contain an IF statement?

 

Something like...

 

<x:if user.admin == true >

<h:outputLabel value="ADMIN" />

<x:else >

<h:outputLabel value="NOT ADMIN" />

</x>

 

 

I would put my IF statement in JSP.

But this doesn't seem to work. 

 

For example

 

<%=user.admin%>

 

 


Re: IF statement..?

Posted by Volker Weber <us...@weber-oldenburg.de>.
No but you can use the rendered attribute.

<h:outputLabel value="ADMIN" rendered="#{user.admin}"/>
<h:outputLabel value="NOT ADMIN" rendered="#{!user.admin}"/>

only the one where rendered evaluates to true is rendered.

Jeffrey Porter wrote:
>  
> 
>  
> 
> Does MyFaces contain an IF statement?
> 
>  
> 
> Something like…
> 
>  
> 
> <x:if user.admin == true >
> 
> <h:outputLabel value="ADMIN" />
> 
> <x:else >
> 
> <h:outputLabel value="NOT ADMIN" />
> 
> </x>
> 
>  
> 
>  
> 
> I would put my IF statement in JSP.
> 
> But this doesn’t seem to work.
> 
>  
> 
> For example
> 
>  
> 
> *<%=*user.admin*%>*
> 
>  
> 
>  
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Re: IF statement..?

Posted by gr...@intellicare.com.
gramani@intellicare.com wrote on 10/20/2005 01:50:37 PM:

> 
> "Jeffrey Porter" <PO...@WMGMAIL.wmg.warwick.ac.uk> wrote on 
> 10/20/2005 01:45:04 PM:
> 
> > 
> > 
> > Does MyFaces contain an IF statement? 
> > 
> > Something like? 
> > 
> > <x:if user.admin == true > 
> > <h:outputLabel value="ADMIN" /> 
> > <x:else > 
> > <h:outputLabel value="NOT ADMIN" /> 
> > </x> 
> > 
> > 
> > I would put my IF statement in JSP. 
> > But this doesn?t seem to work. 
> > 
> > For example 
> > 
> > <%=user.admin%> 
> > 
> 
> You should I think be able to use the "rendered" attribute within 
> <h:outputLabel..? As in: 
> <h:outputLabel value="ADMIN" rendered="user.admin" /> 
> 

umm,.. sorry.. I meant: rendered="#{user.admin}"

> Geeta 

Re: IF statement..?

Posted by gr...@intellicare.com.
"Jeffrey Porter" <PO...@WMGMAIL.wmg.warwick.ac.uk> wrote on 10/20/2005 
01:45:04 PM:

> 
> 
> Does MyFaces contain an IF statement?
> 
> Something like?
> 
> <x:if user.admin == true >
> <h:outputLabel value="ADMIN" />
> <x:else >
> <h:outputLabel value="NOT ADMIN" />
> </x>
> 
> 
> I would put my IF statement in JSP.
> But this doesn?t seem to work. 
> 
> For example
> 
> <%=user.admin%>
> 

You should I think be able to use the "rendered" attribute within 
<h:outputLabel..? As in:
<h:outputLabel value="ADMIN" rendered="user.admin" />

Geeta