Get前台传参和后台接收参数
本人初入javaWeb开发,就被Get和Post的各种传参和接收折磨的痛不欲生,为了对自己三个月的java开发做个总结,顺便加深理解,我做了Get和Post的各种传参情况的总结。
文章及其详细,且都为本人亲自测试过,无论是前台调用Get接口,还是后台处理Get接口的调用,都是绝对可用的!调不通的我都删掉了
Get只适合传递简单参数,复杂的参数请用Post传参
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* @Date 2020/9/26 16:04
* describe: 记录常用的get传参方式
*/
@RestController
public class GetController {
/**
* 单参数
* 请求:http://127.0.0.1:8080/test1?id=1
* 返回:test1:1
*/
@GetMapping(