about SPRINGMVC foreground date as entity class object parameter type conversion error Resolution
Exception Information:
Field error in object ' Tblhouse ' on field ' Housetime ': Rejected value [2018-01-26]; codes [Typemismatch.tblhouse.housetime,typemismatch.housetime,typemismatch.java.util.date,typemismatch]; arguments [Org.springframework.context.support.DefaultMessageSourceResolvable:codes [Tblhouse.housetime, Housetime]; arguments []; Default message [Housetime]]; Default message [Failed to convert property value of type ' java.lang.String ' to required type ' java.util.Date ' for Propert Y ' housetime '; Nested exception is org.springframework.core.convert.ConversionFailedException:Failed to convert from type [ Java.lang.String] to type [@com. Baomidou.mybatisplus.annotations.TableField @ Org.springframework.format.annotation.DateTimeFormat java.util.Date] for value ' 2018-01-26 '; Nested exception is Java.lang.IllegalArgumentException:Invalid format: "2018-01-26" was too short]
description of the exception scene
The front end of the input box for the selection date of the plug-in, select the date completed, request the background to add data, error. resolution Method
You can resolve this error by adding the annotation to an attribute in the entity class
@DateTimeFormat (pattern = "YYYY-MM-DD")
private Date housetime;
Reference articles:
Http://www.linuxidc.com/Linux/2017-06/145204.htm