You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2005/09/20 19:52:39 UTC

[Myfaces Wiki] Update of "ConvertBoolean" by KenWeiner

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by KenWeiner:
http://wiki.apache.org/myfaces/ConvertBoolean

New page:
= Introduction =

It is often necessary to display a Boolean (true/false) on a web page using custom Strings to represent the true and false values.  For example, you might want to display "Yes" instead of "true" and "No" instead of "false".

This <t:convertBoolean> tag, which uses the BooleanConverter internally, can be used to accomplish such formatting.  Its usage is analagous to the use of <f:convertDateTime> to format a java.util.Date.

= Example =

{{{
<h:outputText value="#{backingBean.customer.enjoysJazz}">
    <t:convertBoolean trueValue="Yes" falseValue="No"/>
</h:outputText>
}}}

The "backingBean.customer.enjoysJazz" value binding expression above represents a java.lang.Boolean value.