首页 > 其他分享 >springMVC 获取参数

springMVC 获取参数

时间:2022-09-05 00:04:07浏览次数:72  
标签:username String test6 springMVC request System 获取 参数 password

1.servlet

@GetMapping("/params")
public String test5(HttpServletRequest request){
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    System.out.println(username + " " + password);
    return "test6";
}

 

2 通过控制器形参获取参数

  

@GetMapping("/params2")
public String test6(String username,String password){
    System.out.println(username + " " + password);
    return "test6";
}

 

标签:username,String,test6,springMVC,request,System,获取,参数,password
From: https://www.cnblogs.com/cciscc/p/16656551.html

相关文章