Project Documentation
Foundation

Summary

Tag name: <s:convertStringUtils>
Converter class: org.apache.myfaces.custom.convertStringUtils.StringUtilsConverter
Tag class: org.apache.myfaces.custom.convertStringUtils.StringUtilsConverterTag
converter id: org.apache.myfaces.custom.convertStringUtils.StringUtilsConverter
Converts the format of a string

Converter which modifies a string by changing the input text into upper case, lower case, capitalized. The input string can be optionally trimmed and truncated at some max length. Ellipses (...) can be added to a truncated string.

Provides runtime modification of a string. Uses Apache Lang StringUtils and WordUtils to peform operations.

Usage

<h:outputText value="#{backingBean.customer.name}">
                    <s:convertStringUtils format="capitalize" trim="true"/>
                </h:outputText>
                <h:outputText value="#{backingBean.customer.description}">
                    <s:convertStringUtils trim="true" maxLength="64" appendEllipsesDuringOutput="true"/>
                </h:outputText>
                <h:inputText value="#{backingBean.customer.stateCode}">
                    <s:convertStringUtils format="uppercase" />
                </h:inputText>
                
                <h:outputText value="#{backingBean.customer.name}">
                     <t:convertStringUtils format="capitalize" trim="true" maxLength="50"/>
                </h:outputText>

Instructions

See the convertStringUtils.jsp for an example.

Attributes

Name Type Supports EL? Description
appendEllipsesDuringInput Boolean Yes Boolean value determining if data should be truncated with ellipses during input conversion. Default = false
appendEllipsesDuringOutput Boolean Yes Boolean value determining if data should be truncated with ellipses during output conversion. Default = false
format String Yes Specifies the output case of the string. One of uppercase | lowercase | capitalize
maxLength Integer Yes Integer value for the maximum length of the rendered string. Strings longer than maxValue will be truncated at (maxValue - 3) and an ellipsis '...' will be appended.
trim Boolean Yes Boolean value determining is the string should be trimmed before any other formatting takes place. Default = false