List Info

Thread: if-then-else tag




if-then-else tag
user name
2006-11-22 02:00:36
Hi,

Can you please tell me how can i do a if-then-else logic in
facelet?
From the documentation, it said facelet only support
"if"?

Table 3.2. <c:if/>
Attribute	Required?	Description	Example
var	false	An optional expression variable to store the
result of
evaluating the 'test' attribute.	result
test	true	A required expression that evaluates to a boolean
for
deciding if the body of this tag is included in tree
creation. Note,
an expression evaluating to null is also
false.	#{user.roles['admin']}

Thanks for any suggestion.

------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
For additional commands, e-mail: users-helpfacelets.dev.java.net

if-then-else tag
user name
2006-11-23 10:53:31
You may also use ternary operator if for example your simply want to toggle the displayed value
like this

<h:outputText value=&quot;#{myBean.value=='first' ? 'value is 1': (myBean.value=='second' ? 'value is 2' : 'unknown value'&nbsp;) }&quot; />

&nbsp;
HTH,
 
Harry
 
2006/11/22, ying lcs < yinglcsgmail.com">yinglcsgmail.com>:
Hi,

Can you please tell me how can i do a if-then-else logic in facelet?
From the documentation, it said facelet only support "if&quot;?

Table 3.2. <c:if/&gt;
Attribute &nbsp; &nbsp; &nbsp; Required?&nbsp;   ; &nbsp; Description &nbsp; &nbsp; Example
var &nbsp; &nbsp; false ;  An optional expression variable to store the result of
evaluating the 'test' attribute.  ; &nbsp; &nbsp; &nbsp;result
test &nbsp;  true&nbsp;   ;A required expression that evaluates to a boolean for
deciding if the body of this tag is included in tree creation. Note,
an expression evaluating to null is also false. #{user.roles['admin']}

Thanks for any suggestion.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net">users-unsubscribefacelets.dev.java.net
For additional commands, e-mail: users-helpfacelets.dev.java.net">users-helpfacelets.dev.java.net


if-then-else tag
user name
2006-11-24 03:05:05
Thank you.
Can you please tell me how can i put a 'AND' condition in
the test
attribute in <c:when>?

For example, I would like to do this:

  <c:when test="#{ (fn:length(firstList)> 4)
&& (fn:length(secondList)> 5)}">

i get this error message:
The entity name must immediately follow the '&' in the
entity reference.


On 11/23/06, Harry Co <harryco.magicgmail.com> wrote:
> You may also use ternary operator if for example your
simply want to toggle
> the displayed value
> like this
>
>
> <h:outputText value="#{myBean.value=='first' ?
'value is 1':
> (myBean.value=='second' ? 'value is 2' : 'unknown
value' ) }" />
>
>
> HTH,
>
> Harry
>
> 2006/11/22, ying lcs <yinglcsgmail.com>:
> >
> > Hi,
> >
> > Can you please tell me how can i do a if-then-else
logic in facelet?
> > From the documentation, it said facelet only
support "if"?
> >
> > Table 3.2. <c:if/>
> > Attribute       Required?       Description    
Example
> > var     false   An optional expression variable to
store the result of
> > evaluating the 'test' attribute.        result
> > test    true    A required expression that
evaluates to a boolean for
> > deciding if the body of this tag is included in
tree creation. Note,
> > an expression evaluating to null is also false.
#{user.roles['admin']}
> >
> > Thanks for any suggestion.
> >
> >
>
------------------------------------------------------------
---------
> > To unsubscribe, e-mail:
> users-unsubscribefacelets.dev.java.net
> > For additional commands, e-mail:
> users-helpfacelets.dev.java.net
> >
> >
>
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribefacelets.dev.java.net
For additional commands, e-mail: users-helpfacelets.dev.java.net

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )