The front-end transfers the time directly. If the back-end receives the parameter directly without processing, an exception will appear. Use the annotation @ datetimeformat to solve the problem
problem
@RequestMapping(value="/fetch" , method=RequestMethod.GET)
public @ResponseBody String fetchResult(@RequestParam("from") Date fromDate) {
//Content goes here
}
Treatment method
@RequestMapping(value="/fetch" , method=RequestMethod.GET)
public @ResponseBody String fetchResult(@RequestParam("from") @DateTimeFormat(pattern="yyyy-MM-dd") Date fromDate) {
//Content goes here
}
@RequestParam()
It can be omitted, but the parameter name needs to be consistent with the custom received parameter.
This work adoptsCC agreementReprint must indicate the author and the link of this article