【问题标题】:Render image in SpringMvc在 Spring Mvc 中渲染图像
【发布时间】:2021-09-07 18:26:43
【问题描述】:

我希望我的图片通过这样的 thymeleaf 表达式显示在 receipt_failure.html 中:

<img th:src="@{/src/main/resources/images/icons-alert-circle.png}" />

Image 本身已经落户在这样的 SpringMVC 文件夹结构中:

我不知道问题出在哪里,因为我似乎保留了路径结构,但我在本地环境中遇到了这样的错误

【问题讨论】:

    标签: java html spring-mvc


    【解决方案1】:

    我将 /images 文件夹移动到 /static 文件夹中,然后像这样修复 html:

    <img th:src="@{/images/icons-alert-circle.png}" />
    

    问题已解决

    【讨论】:

      猜你喜欢
      • 2012-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-09
      • 1970-01-01
      • 2011-06-16
      • 2014-02-03
      相关资源
      最近更新 更多