The*_*eph 5 jsf image glassfish
我在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?我的想法是问题出在我的道路上,但我可能错了.
更改
<property name="alternatedocroot1" value="from=/images/* dir=/var/webapp" />
为
<property name="alternatedocroot_1" value="from=/images/* dir=c:\var\webapp" />
注意斜杠。
在我的数据库(MySQL)中,我保存/images/imageExample.jpg
它然后将显示为<h:graphicImage value="#{entity.imageLink}" />
.
我现在可以访问该图像http://localhost:8080/<MyAppName>/images/imageExample.jpg
。
归档时间: |
|
查看次数: |
460 次 |
最近记录: |