首页>代码>Spring Boot整合jsp做为显示层的hello world实例>/springboot-jsp-helloworld/src/main/java/com/hellokoding/springboot/view/HelloController.java
package com.hellokoding.springboot.view;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class HelloController {
@GetMapping({"/", "/hello"})
public String hello(Model model, @RequestParam(value="name", required=false, defaultValue="World") String name) {
model.addAttribute("name", name);
System.out.println(name);
return "hello";
}
}
最近下载更多

最近浏览