SpringBoot的首页与图标定制

目录

1. 首页定制

2. 图标定制


1. 首页定制

首页位置: 

静态资源存放的目录有:resources/public 、resources/static 、resources/resources 、resources/templates  ;  

其中 resources/public 、resources/static 、resources/resources 目录下写好index.html直接运行就可以看见HTML页面; 访问地址:http://localhost:8080

(通常使用这种方式)若将index.html页面存放在 resources/templates 目录下,则需要controller 来控制跳转。注意:需要引入thymeleaf依赖。 访问地址:http://localhost:8080/index

<!--index.html-->
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">   <!--导入Thymeleaf约束-->
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div th:text="${msg}"></div>
</body>
</html>
//controller.java
package com.study.springboot_2_welcomepage.controller;


import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller   //表示这个类会跳转到一个页面
public class IndexController {

    @RequestMapping("/index")
    public String index(Model model){
        model.addAttribute("msg","thymeleaf");
        return "index";
    }
}
2. 图标定制

将想要的图标设置成如下命名规则即可实现图标定制。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值