(1)一般请求
http://localhost:8081/hello/index?name=yankai&password=123456
@RequestMapping(value = "/index",method = RequestMethod.GET,params = {"name","password"}) public String index(@RequestParam("name") String str, int password){ System.out.println(str); System.out.println(password); System.out.println("执行了index....."); return "index"; }
(2)REST请求
http://localhost:8081/hello/rest/yankai/123456
@RequestMapping( "/rest/{name}/{password}") public String rest(@PathVariable("name") String name,@PathVariable("password") int password){ System.out.println(name); System.out.println(password); System.out.println("执行了rest....."); return "index"; }