【发布时间】:2012-11-14 02:22:29
【问题描述】:
抱歉,如果问题没有正确提出。图像在 struts 项目中显示良好,但在 JSF2 项目中却没有。所有的 CSS 和按钮都渲染得很好except image that has url in css。
文件夹结构
resources -> css -> bootstrap.min.css
resources -> img -> glyphicons-halflings.png
bootstrap.min.css
background-image: url("../img/glyphicons-halflings.png");
1 -
如果我使用<h:outputStylesheet library="css" name="bootstrap.min.css"/>,则生成的背景图像网址为http://localhost:8000/img/glyphicons-halflings.png,因此无法加载图像。应该是http://localhost:8000/resources/img/glyphicons-halflings.png
2 -如果我使用<link href="#{request.contextPath}/resources/css/bootstrap.min.css" rel="styleSheet" type="text/css"/>而不是
Firefox -> Firebug -> Net tab {资源添加多次}
http://localhost:8000/resources/resources/img/glyphicons-halflings.png
不确定如何加载 css 中并应用于类的图像。
将 EDIT 图标显示为点击下一页的链接。
<h:outputLink value="edit.xhtml" >
<i class="icon-edit" ></i>
<f:param name="id" value="#{person.id}"/>
</h:outputLink>
【问题讨论】:
标签: jsf-2 resources background-image outputstylesheet