public class TrimConverter extends Object implements Converter
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 |
---|---|
Object |
getAsObject(FacesContext context,
UIComponent component,
String submittedValue) |
String |
getAsString(FacesContext context,
UIComponent component,
Object modelValue) |
public Object getAsObject(FacesContext context, UIComponent component, String submittedValue)
getAsObject
in interface Converter
public String getAsString(FacesContext context, UIComponent component, Object modelValue)
getAsString
in interface Converter
Copyright © 2012–2019 OmniFaces. All rights reserved.