首页>代码>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";
    }
}
最近下载更多
ruiqiweb  LV10 1小时前
xiaobaitud  LV13 1月10日
失落的小象  LV10 2021年6月24日
快乐男孩  LV6 2021年6月1日
fanghao  LV16 2021年3月18日
123456nty  LV36 2021年3月11日
sssssssyy  LV10 2021年2月24日
wu970128  LV5 2020年11月10日
jiang8816  LV6 2020年10月27日
最近浏览更多
ruiqiweb  LV10 1小时前
164048465 2月23日
暂无贡献等级
yohohero  LV1 1月14日
xiaobaitud  LV13 1月10日
lewiszz  LV2 2022年12月11日
200171  LV8 2021年6月26日
失落的小象  LV10 2021年6月24日
lbwnblbwnblbwnb  LV7 2021年6月21日
zxhjy5  LV6 2021年6月7日
快乐男孩  LV6 2021年6月1日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友