The request sent by the client was syntactically incorrect.-Spring MVC + JDBC Template

前端 未结 6 1660
攒了一身酷
攒了一身酷 2020-11-29 05:52

I am newbie to Spring MVC. I was stuck by an error while running my project Error-The request sent by the client was syntactically incorrect. I have an enti

6条回答
  •  清酒与你
    2020-11-29 06:41

    I had a similar issue recently and solved it by annotating my Date field with the @DateTimeFormat. In your case, you would edit your PatientInfo.java file to:

        import org.spring.framework.annotation.DateTimeFormat;
    
        @Column(name = "DateOfBirth")
        @Temporal(TemporalType.TIMESTAMP)
        @DateTimeFormat(pattern = ${pattern})
        private Date dateOfBirth;
    

    Make sure to replace ${pattern} with a string representing the format that will be received (e.g. "yyyy-MM-dd").

提交回复
热议问题