zoukankan      html  css  js  c++  java
  • springboot用controller跳转html页面

    之前SSM框架,里面有webapps文件夹,用来存放前端页面和各种前端资源,现在SpringBoot中没有webapps文件夹,springboot结构如下:

    第一、resourses下文件夹public是我自己创建的,通过local host:8080/index.html可以直接访问。

    第二、通过controller层访问templates中的文件夹:

    步骤一、application.properties 配置中添加spring.thymeleaf.prefix=classpath:/templates/

    步骤二、pom.xml文件中添加依赖:

            <!-- 访问html文件依赖begin -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-thymeleaf</artifactId>
            </dependency>
            <!-- 访问html文件依赖begin -->    

    步骤三、controller层访问http://localhost:8080/test  :

    打完收工。

  • 相关阅读:
    java堆
    本地方法栈
    java虚拟机栈
    Java 程序计数器
    面向对象 基本概念 复习
    if __name__=='__main__'
    偏函数与模块
    可变参数与关键字参数(复习材料)
    匿名函数
    闭包
  • 原文地址:https://www.cnblogs.com/steveshao/p/11813385.html
Copyright © 2011-2022 走看看