gpt4 book ai didi

java - Spring Boot 无法在/resources/static/images 文件夹中找到图像

转载 作者:行者123 更新时间:2023-11-30 05:38:20 26 4
gpt4 key购买 nike

我正在尝试像这样加载 html 中的图像

<body>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-4"><img class="img-fluid" src="../static/images/zep.png" /></div>
</div>
<div class="row justify-content-center">
<div class="col-md-12 text-center"><h1>Coming Soon.</h1></div>
<!-- <div class="col-md-12 text-center"><p>Subscribe to our newsletter and stay tuned</p></div> -->
</div>
<!-- <div class="col-md-12 text-center"><button class="btn btn-custom">Subscribe</button></div> -->
</div>
</body>

这是我的文件夹结构 enter image description here

所以当我运行它时,我得到

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

我做错了什么?任何帮助,将不胜感激。谢谢

最佳答案

您不应在 img 标记的 src 中包含 static。放置在 src/main/resources/static 中的资源将从应用程序的根目录提供。这意味着 src/main/resources/static/images/zep.png 将从 /images/zep.png 提供服务。

关于java - Spring Boot 无法在/resources/static/images 文件夹中找到图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56195492/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com