对于controller包中的代码
package com.itheima.controller; import jakarta.servlet.http.HttpServletRequest; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class RequestController { // @RequestMapping("simpleParam") // public String simpleParam(HttpServletRequest request) // { // String name=request.getParameter("name"); // String ageStr=request.getParameter("age"); // int age=Integer.parseInt(ageStr); // System.out.println(name+":"+age); // return "OK"; // } @RequestMapping("simpleParam") public String simpleParam(String name,Integer age) { System.out.println(name+":"+age); return "OK"; } }
启动springboot项目,在postman软件中监测
标签:String,10.26,age,simpleParam,import,public,name From: https://www.cnblogs.com/gjsgjs/p/17912173.html