我在index.xhtml文件中显示图像时遇到问题.
我希望我的数据库中的链接指向图像文件,以便一个<h:graphicImage/>或<img />标记可以显示它.目前仅使用localhost.
我已设法将图像保存到c:\ var\webapp\images \并添加<property name="alternatedocroot1" value="from=/images/* dir=/var/webapp" />到我的glassfish-web.xml并使用:
<h:graphicImage value="#{entity.imageLink}" />
<img alt="#{entity.title}" src="#{entity.imageLink}" />
Run Code Online (Sandbox Code Playgroud)
但我从来没有设法显示任何图像!应该在我的数据库中写什么来显示保存在c:\ var\webapp\images\imageExample.jpg中的imageExample.jpg?我的想法是问题出在我的道路上,但我可能错了.