javaEEday05-请求响应-请求-json参数

This commit is contained in:
2026-05-13 10:10:05 +08:00
parent e0d00d8b9a
commit a3a0b4ce0d

View File

@@ -3,6 +3,7 @@ package com.inmind.controller;
import com.inmind.pojo.User;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@@ -66,4 +67,12 @@ public class RequestController {
return "OK";
}
//日期参数
@RequestMapping( "/jsonParam")
//@RequestBody: 将请求体中的json数据映射为java对象
public String jsonParam(@RequestBody User user){
System.out.println(user);
return "OK";
}
}