【问题标题】:Error not found - path for images未找到错误 - 图像的路径
【发布时间】:2018-02-15 14:56:33
【问题描述】:

我正在为我的应用程序使用 Spring 和 Angular2。但是我的图片没有显示在 html 中,我收到了这个错误

GET http://localhost:8080/src/main/resources/images/opcije.png 404(未找到)

我的根目录是kongres-spring,src在里面,其他文件夹structer和path里一样,文件夹里有图片。那么,为什么我的图片没有显示出来呢?

【问题讨论】:

  • 能否提供一些代码?

标签: html spring angular image


【解决方案1】:

如果您使用标准 Spring Boot 项目并添加图片:

src/
src/main
src/main/java
src/main/java/hello
src/main/java/hello/HelloController.java
src/main/java/hello/Application.java
src/main/resources
src/main/resources/static
src/main/resources/static/images
src/main/resources/static/images/test.jpeg
src/test
src/test/java
src/test/java/hello
src/test/java/hello/HelloControllerTest.java
src/test/java/hello/HelloControllerIT.java

它们将在

http://localhost:8080/images/test.jpeg

请参阅文档here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-10
    • 2017-12-21
    • 1970-01-01
    • 1970-01-01
    • 2022-01-14
    • 2014-07-03
    • 2015-03-25
    • 2016-07-23
    相关资源
    最近更新 更多