原文鏈接:https://blog.csdn.net/reee112/article/details/89279286 (侵刪)
@RequestParam 注解如果是個map類型,那么mvc適配器就將參數封裝到map中
請求地址:localhost:8080/test?name=testname&pwd=123456
@RequestMapping("/test") public Object hello2(@RequestParam Map query) { String name = (String) query.get("name"); String pwd = (String) query.get("pwd"); System.out.println(name); System.out.println(pwd); return query; }
返回參數:
{ "name": "testname", "pwd": "123456" }