java.lang.Object
org.omnifaces.converter.TrimConverter
- Direct Known Subclasses:
ToLowerCaseConverter,ToUpperCaseConverter
The omnifaces.TrimConverter is intented to trim any whitespace from submitted String values.
This keeps the data store free of whitespace pollution.
This converter does by design no conversion in getAsString().
Usage
This converter is available by converter ID omnifaces.TrimConverter. Just specify it in the
converter attribute of the component referring the String property. For example:
<h:inputText value="#{bean.username}" converter="omnifaces.TrimConverter" />
Since OmniFaces 4.5 it's also available by <o:trimConverter> tag.
<h:inputText value="#{bean.username}">
<o:trimConverter />
</h:inputText>
You can also configure it application wide via below entry in faces-config.xml without the need to
specify it in every single input component:
<converter>
<converter-for-class>java.lang.String</converter-for-class>
<converter-class>org.omnifaces.converter.TrimConverter</converter-class>
</converter>
- Since:
- 2.6
- Author:
- Bauke Scholtz
-
Field Summary
Fields inherited from interface jakarta.faces.convert.Converter
DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAsObject(FacesContext context, UIComponent component, String submittedValue) getAsString(FacesContext context, UIComponent component, String modelValue)
-
Constructor Details
-
TrimConverter
public TrimConverter()
-
-
Method Details
-
getAsObject
- Specified by:
getAsObjectin interfaceConverter<String>
-
getAsString
- Specified by:
getAsStringin interfaceConverter<String>
-