RestFul 风格
package com.example.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@Controller
public class RestFulController {
@GetMapping("/restful/{id}/{name}")
public String restful(@PathVariable() Integer id, @PathVariable() String name, Model model) {
model.addAttribute("msg", "id=" + id + ",name=" + name);
return "app";
}
}@Controller
public class RestFulController {
@GetMapping("/restful/{id}/{name}")
public String restful(@PathVariable("id") Integer uuid, @PathVariable() String name, Model model) {
model.addAttribute("msg", "id=" + uuid + ",name=" + name);
return "app";
}
}最后更新于