栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

项目--thymeleaf修改项目资源路径

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

项目--thymeleaf修改项目资源路径

1.创建项目时选择web和thymeleaf,删除不需要的文件(选择文件,按delete)

2.js,css,img放在resource中的static中,页面放在resources中的templates

3.controller中的get请求方式

package com.cc.springboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class ProviderController {

    //@RequestMapping(value="/providers",method= RequestMethod.GET)
    @GetMapping("/providers")
    public String list(){
      return "provider/list";
    }
}

4.热部署依赖和配置文件

    
        
            org.springframework.boot
            spring-boot-devtools
        
spring.thymeleaf.cache=false

5.引入css,图片引入,引入webjars(先pom依赖包)

 
      
  
        
            org.webjars
            jquery
            3.3.1
        

访问页中,查看页面源代码,点击jquery链接出现代码,则说明webjars成功

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/781973.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号