Springboot 页面访问不到静态资源

问题:在HTML文件中引入图片,但是浏览器访问不到图片。

index.html:

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"><head><meta charset="UTF-8"><title>Helllo Jenkins</title>
</head>
<body><h1 style="text-align: center;">This is my first demo for Jenkins </h1><div align="center"><img th:src="@{/static/doudou.jpg}" style="width: 80%;height: 70%"></div></body>
</html>

浏览器错误信息:

Failed to load resource: the server responded with a status of 404 ()

解决方法:

在配置文件application.properties设置静态资源的访问路径

# 只有静态资源的访问路径为/static/**时,才会处理请求
spring.mvc.static-path-pattern=/static/**

重新启动后、完美解决问题

Springboot 页面访问不到静态资源Failed to load resource: the server responded with a status of 404 ()相关推荐

  1. 浏览器控制台显示 Failed to load resource: the server responded with a status of 404 ()

    今天做项目时,前端资源可以正常打开,但是使用SpringBoot启动时,前端控制台却显示浏览器控制台显示 Failed to load resource: the server responded w ...

  2. Failed to load resource: the server responded with a status of 404 ()

    问题: Failed to load resource: the server responded with a status of 404 ()  在SpringMVC中,你可能会遇到访问页面的时候 ...

  3. Failed to load resource: the server responded with a status of 404 (Not Found)啥意思

    Failed to load resource: the server responded with a status of 404 (Not Found)这个错误表示,服务器无法找到您请求的资源.具 ...

  4. Failed to load resource: the server responded with a status of 404 (Not Found) iml文件配置错误

    运行报错: Failed to load resource: the server responded with a status of 404 (Not Found) 原因: 发现是iml文件配置错 ...

  5. 无法加载静态的图片Failed to load resource: the server responded with a status of 404 (Not Found)

    想到的解决办法的思路是 1,是否是路径的错误 2,是否在resource中定义了静态资源加载(最好是在webapp下独立创建一个放静态资源的文件) 检查发现是路径的错误,可是为什么会出现路径的错误呢 ...

  6. Bug解决:Failed to load resource the server responded with a status of 404 ()

    问题描述 在学习SpringMVC的时候,因为要学习ajax,然后导入了jquery,在浏览器控制台打印报错,初步断定是jquery导入失败问题 解决方法 一直在导入jquery上下功夫,半天发现不是 ...

  7. Failed to load resource: the server responded with a status of 404

    搞来搞去附件下载请求的地址老包404,我用的easyui1.5   引用下载插件 <script type="text/javascript" src="${ctx ...

  8. Failed to load resource: the server responded with a status of 404 ()解决办法

    这是由于服务器编译的问题导致的.在服务器编译打包时,有些资源没有编译进去,导致服务器里不能访问一些资源. 解决方法: 1.将无法扫描到的资源放入out文件夹对应的位置中 例如: 将(1)处的文件夹放到 ...

  9. Failed to load resource:the server responded with a status of 404()

    jsp页面: 原因: 声明文档的解析类型(document.compatMode),避免浏览器的怪异模式.document.compatMode: BackCompat:怪异模式,浏览器使用自己的怪异 ...

最新文章

  1. [SDOI2006] 保安站岗
  2. html页面加载时执行ajax请求,页面加载完成之后,ajax远程调用的数据才显示出来。有没有可能使ajax部分的程序执行完了,页面再加载完成...
  3. mysql varchar,bigint,char三种类型性能的比较
  4. Redis 源码分析之故障转移
  5. SVN 的安装与配置
  6. 不支持给定路径的格式_申论写作标准格式汇总,考前一定要看!
  7. Web开发HTTP中URI和URL的情感纠葛
  8. LoadRunner11下载、安装与破解
  9. 无法安装打印机,打印处理器不存在
  10. mysql只有frm_MySQL只有.frm和.ibd文件如何批量恢复InnoDB表-爱可生
  11. mysql查询耗时操作_mysql记录耗时的sql实例详解
  12. 股票K线5,15,30,60分钟数据接口
  13. user.has_perm(perm) 中参数 perm 的格式问题 - Django
  14. (ASCII代码 )密码破译
  15. 直流电源线缆 高速电缆 分类
  16. Android进阶之路 - 拉伸的弹簧效果
  17. 五大列级庄_1855列级庄分级
  18. python模拟登陆 验证码el_python 模拟登陆163邮箱
  19. java trigger_Quartz教程四:Trigger
  20. java lombok.getter_Java如何使用Lombok生成getter和setter?

热门文章

  1. android点击加号,Android仿微信朋友圈点击加号添加图片功能
  2. python 发送邮件connect none_使用python向IP地址发送邮件
  3. Linux九大哲学原理,Linux/Unix设计思想(全新阐释开源哲学,Jon “maddog” Hall作序推荐)...
  4. 软件测试项目计划书总结,软件测试项目计划书.doc
  5. css导航栏_使用CSS的导航栏
  6. 有人说:轻量级锁一定比重量级锁快!我忍不住笑了
  7. python elif可以单独使用_Celery在python中的单独使用
  8. matlab 判断鼠标按下_轻巧可爱,支持多设备——雷柏Ralemo Air1乐萌鼠标
  9. 混凝土墙开洞_易县混凝土剪力墙切割常见问题
  10. 安费诺amphenol连接器_安费诺的Ellison谈信号完整性职业和他的免费开源PCB设计软??件...