Passing a date as JSON with Spring MVC and Jackson

后端 未结 2 1071
不思量自难忘°
不思量自难忘° 2020-12-21 10:59

I have a class with a java.util.Date field that I wish to pass from a client to a Spring controller. The controller returns HTTP 415 whenever I make the request. I have trie

2条回答
  •  再見小時候
    2020-12-21 11:29

    Instead of string, just pass date object from jsp as below.

    var date = new Date();
    var formData = {'date':date};
    

    And in the dto, make variable of type java.util.Date.

提交回复
热议问题