Example usage for org.springframework.beans.propertyeditors StringTrimmerEditor StringTrimmerEditor

List of usage examples for org.springframework.beans.propertyeditors StringTrimmerEditor StringTrimmerEditor

Introduction

In this page you can find the example usage for org.springframework.beans.propertyeditors StringTrimmerEditor StringTrimmerEditor.

Prototype

public StringTrimmerEditor(boolean emptyAsNull) 

Source Link

Document

Create a new StringTrimmerEditor.

Usage

From source file:com.springinpractice.ch11.web.controller.application.ApplicationPackageController.java

/**
 * @param binder//from  ww w .j a v a 2s .co m
 */
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
    binder.setAllowedFields("version");
}

From source file:org.jasig.cas.services.web.RegisteredServiceSimpleFormController.java

/**
 * Sets the require fields and the disallowed fields from the
 * HttpServletRequest.//from  w  w  w . j  a  v  a2  s  .  c  om
 * 
 * @see org.springframework.web.servlet.mvc.BaseCommandController#initBinder(javax.servlet.http.HttpServletRequest,
 * org.springframework.web.bind.ServletRequestDataBinder)
 */
protected final void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder)
        throws Exception {
    binder.setRequiredFields(new String[] { "description", "serviceId", "name", "allowedToProxy", "enabled",
            "ssoEnabled", "anonymousAccess", "evaluationOrder" });
    binder.setDisallowedFields(new String[] { "id" });
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

From source file:com.springinpractice.ch11.web.controller.application.ApplicationModuleController.java

/**
 * @param binder/* w w w.j  a  v  a 2s  .c  o  m*/
 */
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
    binder.setAllowedFields("name", "shortDescription", "groupId", "moduleId");
}

From source file:ru.mystamps.web.controller.AccountController.java

@InitBinder("registerAccountForm")
protected void registrationInitBinder(WebDataBinder binder) {
    binder.registerCustomEditor(String.class, "email", new StringTrimmerEditor(false));
}

From source file:common.bind.CommonBindValidator.java

/**
 * an empty method//from   www .  java 2s. c  o m
 * @param binder
 */
@Override
protected void initBinder(ServletRequestDataBinder binder) {
    binder.setBindEmptyMultipartFiles(false);
    binder.setRequiredFields(required_fields);
    binder.setAllowedFields(allowed_fields);
    binder.setFieldMarkerPrefix("_");
    binder.setFieldDefaultPrefix("!");
    if (editors != null) {
        Iterator<Entry<String, PropertyEditor>> i = editors.entrySet().iterator();
        while (i.hasNext()) {
            Entry<String, PropertyEditor> e = i.next();
            binder.registerCustomEditor(String.class, e.getKey(), e.getValue());
        }
    }

    binder.registerCustomEditor(String.class, new StringTrimmerEditor(false));
}

From source file:it.cilea.osd.jdyna.widget.WidgetCheckRadio.java

@Override
/**/*from  www.  j a  v a  2  s  . c  o  m*/
 * Restituisce lo StringTrimmer editor configurato per la conversione delle stringhe vuote in null
 */
public PropertyEditor getPropertyEditor(IPersistenceDynaService applicationService) {
    return new StringTrimmerEditor(true);
}

From source file:org.ng200.openolympus.controller.auth.RegistrationController.java

@InitBinder
protected void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder)
        throws Exception {
    binder.registerCustomEditor(LocalDate.class, RegistrationController.dateEditor);
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

From source file:ru.mystamps.web.controller.AccountController.java

@InitBinder("activateAccountForm")
protected void activationInitBinder(WebDataBinder binder) {
    binder.registerCustomEditor(String.class, "login", new StringTrimmerEditor(true));
    binder.registerCustomEditor(String.class, "name", new StringTrimmerEditor(true));
}

From source file:org.tonguetied.web.CountryController.java

@Override
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(CountryCode.class, new CountryCodeSupport());
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

From source file:org.tonguetied.web.LanguageController.java

@Override
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(LanguageCode.class, new LanguageCodeSupport());
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}