SpringMVC reception time values of type String (entity class is Date) Conversion

String String type receiving SpringMVC

entity bean is Date

Join bind

    @InitBinder
    public void initBinder(WebDataBinder binder) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
        dateFormat.setLenient(false);
        binder.registerCustomEditor (a Date. class , new new the CustomDateEditor (the dateFormat, to true ));    // to true: enable input nulls, false: can not be null 
    }

And the individual strings are receiving entity class bean onset

Guess you like

Origin www.cnblogs.com/ukzq/p/12094445.html
Recommended