简体   繁体   English

无法在JSF中加载CSS

[英]Can't loading css in JSF

I'm using the JSF 2.2. 我正在使用JSF 2.2。 I can't add .css in my .xhtml page. 我无法在.xhtml页面中添加.css Code in .xhtml .xhtml代码

<h:head>
    <title>Login Page</title>
</h:head>

<h:body>
<h:outputStylesheet library="resources/css" name="style.css" id="cascade1"/>

Also I tried declare it into a <h:head> with the same result. 我也尝试将其声明为具有相同结果的<h:head> FireBug is seeing this resource but it is showing message: FireBug看到此资源,但显示消息:

Reload the page to get source for .../javax.faces.resource/style.css.xhtml;... 重新加载页面以获取... / javax.faces.resource / style.css.xhtml; ...的源代码

There is no need to use the library attribute: 无需使用library属性:

<h:outputStylesheet name="css/style.css"  />

This way, the JSF servlet expects the style.css file to be in /resources/css path. 这样,JSF servlet期望style.css文件位于/resources/css路径中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM