Angular Js post date Bad Request in Java Spring mvc

前端 未结 2 946
無奈伤痛
無奈伤痛 2021-01-23 06:42

In Java Spring MVC project, I post an object to a @RestController and the object I post has an date property. If I remove this property, the post works successfully. But with t

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-23 07:28

    You need to ensure a better format in your JS code for the JSON Date. There is a discussion here that you should consider - The "right" JSON date format.

    Once you have this in order you need a corresponding Date Time Formatter in Spring MVC to be able to convert the JSON Date String into Date Object - spring mvc date format with form:input; and here's another example.

提交回复
热议问题