Report 400: data type mismatch:
The type of time passed in the path URL is string
You can add this annotation in the controller layer to convert string to java.util.date
@DateTimeFormat(pattern = "yyyy-MM-dd") Date begin
@GetMapping
public List<Demand> listAll(@RequestParam("begin") @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam("end") @DateTimeFormat(pattern = "yyyy-MM-dd")Date endTime){
System.out.println("beginTime"+beginTime);
System.out.println("endTime:"+endTime);
return demandClient.queryAllDemands(beginTime, endTime);
}
date begintime in the figure; If the front-end parameter is not begintime but begin, it needs to be defined as begin. font> in @ requestparam
Read More:
- Jsonformat annotation solves the problem of time format in the front end of localdatetime
- How to receive localdatetime type in background
- How to get the current time in java time string
- The attribute error: he has no attributes.
- java.text.ParseException: Unparseable date: “2021-06-24“
- Java uses regular expressions to intercept the contents between specified strings
- Java compareto() method
- ‘Conversion failed when converting date and/or time from character string.DB-Lib error message 241,
- About error statuslogger no log4j2 configuration file found
- Register global time filter in main.js in Vue
- 1、 Java 8 date and local date
- [Solved] Flowable Start Error: ClassCastException: java.time.LocalDateTime cannot be cast to java.lang.String
- An unable to locate appropriate constructor on class solution appears
- Solution of error converting data type varchar to datetime in SQL Server
- Java – read all the files and folders in a certain directory and three methods to get the file name from the file path
- Three ways to get form data in struct2
- Java.lang.Character . isdigit() and isletter() methods
- Java String.split () special character processing
- Java regular matching returns all matches
- Java gets the type t.class of generic t