JSF中使用graphicImage组件无法显示图片的问题求助
JSF graphicImage组件无法显示图片问题
我是JSF新手,尝试用graphicImage组件显示图片,但图片始终无法显示。我已经检查了代码、文件夹结构、图片文件有效性等所有常见点,问题仍未解决。
我的页面代码如下:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <title>Survey Website</title> <meta name="viewport" content="width=device-width, initial-scale=1"/> </h:head> <h:body> <h:form> <h:panelGrid> <h:graphicImage alt="There is error" library="image" name="/form.png" /> <h2>Khảo sát</h2> </h:panelGrid> </h:form> </h:body> </html>
我尝试过以下几种写法,结果都无效:
<h:graphicImage alt="There is error" library="image" name="/form.png" /> <h:graphicImage alt="There is error" url="/resources/image/form.png" /> <h:graphicImage alt="There is error" value="/resources/image/form.png" />
另外我尝试给图片设置宽高属性,但在浏览器开发者工具中查看时,图片尺寸仍然显示为0x0。浏览器控制台有一些错误信息,但我不确定是否和图片显示问题相关。
内容的提问来源于stack exchange,提问作者Hudson Bui
相关产品推荐
相关产品推荐

