「Spring」@Controllerアノテーションのサンプル

構文
@Controller
public class クラス名

サンプルコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@Controller
public class UsetController {
@GetMapping("/user")
public String handle(Model model) {
model.addAttribute("message", "this is a test message");
return "index";
}
}
@Controller public class UsetController { @GetMapping("/user") public String handle(Model model) { model.addAttribute("message", "this is a test message"); return "index"; } }
@Controller
public class UsetController {

    @GetMapping("/user")
    public String handle(Model model) {
        model.addAttribute("message", "this is a test message");
        return "index";
    }
}

 

SpringMVC

Posted by arkgame