public class TrimConverter extends Object implements Converter<String>
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()
.
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" />
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>
DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME
Constructor and Description |
---|
TrimConverter() |
Modifier and Type | Method and Description |
---|---|
String |
getAsObject(FacesContext context,
UIComponent component,
String submittedValue) |
String |
getAsString(FacesContext context,
UIComponent component,
String modelValue) |
public String getAsObject(FacesContext context, UIComponent component, String submittedValue)
getAsObject
in interface Converter<String>
public String getAsString(FacesContext context, UIComponent component, String modelValue)
getAsString
in interface Converter<String>
Copyright © 2012–2022 OmniFaces. All rights reserved.