package pers.hanchao.myspringmvc.hello;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
/**
* <p>Hello Spring MVC:用JavaConfig代替xml,消除xml配置文件</p>
* @author hanchao 2018/1/20 19:19
**/
@Controller
public class HelloController {
@GetMapping("/helloworld")
public String helloWorld(Model model){
model.addAttribute("helloworld","Hi Spring MVC");
return "helloworld/helloworld";
}
}<%--
Created by IntelliJ IDEA.
User: hanchao
Date: 2018/1/20
Time: 19:20
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<h3>${helloworld}</h3>
</body>
</html><html>
<body>
<h2>Hello World!</h2>
<a href="/helloworld">Hello World!</a>
</body>
</html>
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-61616-3.html
不卡
一直就比大陆人有更高品质的生活和更公平法治的社会环境
我担心的