Class TrimConverter

  • All Implemented Interfaces:
    Direct Known Subclasses:
    ToLowerCaseConverter, ToUpperCaseConverter

    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:

    Bauke Scholtz