gpt4 book ai didi

jsf - 如何在 p :graphicImage from the resource folder 中引用图像

转载 作者:行者123 更新时间:2023-12-04 21:43:30 24 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





How to reference CSS / JS / image resource in Facelets template?

(4 个回答)


4年前关闭。




我在以下路径中有一个图像:

resources
\_____img
\_______sites
\_______reddit.png

我用这个命令行来引用它:
<p:graphicImage library="img" name="/sites/reddit.png"/>

但在开发控制台中它说:
GET http://localhost:8080/RES_NOT_FOUND 404 ()

并且图像没有被渲染。

怎么了?

最佳答案

Kukeltje 建议的 url ( What is the JSF resource library for and how should it be used? ) 是解决此问题的权威资源。

基于那个 URL,我认为资源文件夹不应该在 WEB-INF 下。假设您使用的是默认的 Maven 项目布局,它应该具有如下结构

src/main/webapp/resources
-------------------------/img
-----------------------------/sites
-----------------------------------/reddit.png
src/main/webapp/WEB-INF
-----------------------/web.xml

那么下面的 JSF 构造应该可以工作。
<p:graphicImage library="img" name="sites/reddit.png"/>

关于jsf - 如何在 p :graphicImage from the resource folder 中引用图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40771002/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com