无法从maven的html页面访问图像 [英] Can't access image from html page in maven
问题描述
MyProject
- src
------ main
----------资源
-------------------图像
-------------------------- myimage.png
---------- webapp
---------------- index.html
---------- WEB-INF
-------- -------- web.xml
这是我的index.html源代码。
< img alt =src =images / myimage.png>
当我运行这个图片时并没有在浏览器中显示。我听说我们应该在web.xml文件中声明/映射资源目录,但我没有找到任何东西。
我在 img src
路径。
我只需要在我的html页面显示图片。
可以任何人都可以帮助你。
正如 usage page ,你应该把这些文件放在 src / main / webapp
。只有当你需要类路径上的图像时(不是这种情况),你应该把它们放在 src / main / resources
下
I am new to maven web application, below is my eclipse directory..
MyProject
-- src
------main
----------resources
-------------------images
--------------------------myimage.png
----------webapp
----------------index.html
----------WEB-INF
----------------web.xml
Here is my index.html source.
<img alt="" src="images/myimage.png">
When I run this image is not shown in browser. I heard somewhere we should declare/map the resource directory in web.xml file but I did not found anything.
I have tried every possible ways in img src
path.
I just need to show the image in my html page.
Can anybody help..
As described on the usage page of the maven-war-plugin, you should put those files under src/main/webapp
. Only if you need images on the classpath (which is not the case), you should put them under src/main/resources
这篇关于无法从maven的html页面访问图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!