81,092
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<a href="http://localhost:9002/gavin/path/getPath?name=zhangsan">Test Get Method</a>
</body>
</html>
后端代码
package com.gavinbj.confmng.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/path")
public class HelloController {
@GetMapping("/getPath")
public String hello(@RequestParam(value="name", required = true) String name) {
return "This is test API." + name;
}
}
返回结果