Example usage for org.springframework.web.bind ServletRequestDataBinder setConversionService

List of usage examples for org.springframework.web.bind ServletRequestDataBinder setConversionService

Introduction

In this page you can find the example usage for org.springframework.web.bind ServletRequestDataBinder setConversionService.

Prototype

public void setConversionService(@Nullable ConversionService conversionService) 

Source Link

Document

Specify a Spring 3.0 ConversionService to use for converting property values, as an alternative to JavaBeans PropertyEditors.

Usage

From source file:org.bibsonomy.webapp.util.spring.controller.MinimalisticControllerSpringWrapper.java

@Override
protected void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder)
        throws Exception {
    super.initBinder(request, binder);

    /*/* www. j  a v a2s  . co  m*/
     * set convertion service (string => enum, string => class)
     */
    binder.setConversionService(this.conversionService);

    /*
     * Register a custom date editor to support binding of date fields.
     * 
     * FIXME: This is a HACK to allow the DBLP update to set the date of 
     * (bookmark) posts. The problem is, that the date format is now fixed 
     * for ALL our controllers, since we can't override this initBinder
     * method (since we're using this MinimalisticController ... wrapper)
     *  
     */
    binder.registerCustomEditor(Date.class, new CustomDateEditor(DATE_FORMAT, true));

    /*
     * setting the dis/allowed fields for the binder
     */
    binder.setAllowedFields(allowedFields);
    binder.setDisallowedFields(disallowedFields);
}