Java tutorial
package com.webbfontaine.valuewebb.model.converters; import org.apache.commons.lang3.StringUtils; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; /** * Copyrights 2002-2010 Webb Fontaine * This software is the proprietary information of Webb Fontaine. * Its use is subject to License terms. * User: nigiyan * Date: Feb 5, 2010 */ public class ToStringConverter implements Converter { @Override public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String s) { return StringUtils.trimToNull(s); } @Override public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object o) { return o.toString().trim(); } public static ToStringConverter sharedInstance() { return _this; } private static ToStringConverter _this = new ToStringConverter(); }