zoukankan      html  css  js  c++  java
  • 跟我学Spring Boot(二)Hello World

    1、打开DemoApplication添加如下代码

    package com.example;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.stereotype.Controller;
    import org.springframework.ui.Model;
    import org.springframework.web.bind.annotation.RequestMapping;
    
    @Controller //1
    @SpringBootApplication
    public class DemoApplication {
    
        //2
        @RequestMapping("/helloboot")
        public String helloBoot(Model model){
            return "index";
        }
        public static void main(String[] args) {
            SpringApplication.run(DemoApplication.class, args);
        }
    }

    2、在resources/template/目录下新建index.html

    代码如下

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8"/>
        <title>Title</title>
    </head>
    <body>
    hello world
    </body>
    </html>

    这里需要注意的是meta 部分一定要有结束符不然后提示下面错误

    org.xml.sax.SAXParseException: 元素类型 "meta" 必须由匹配的结束标记 "</meta>" 终止。

  • 相关阅读:
    css3多列
    伪元素
    text文本样式二
    透明登录框
    透明度设置opacity
    超链接
    meta标签
    奇偶选择器
    OC跟Swift混编
    Swift中as as! as?的区别
  • 原文地址:https://www.cnblogs.com/lvlv/p/6159740.html
Copyright © 2011-2022 走看看