我使用JSF/Facelets的一個項目工作的CSS文件不被使用的認可。我想在View XHTML上做一些CSS更改,但是當我在我的Tomcat服務器中部署我的Web應用程序時,什麼也沒有發生。我嘗試了很多技巧,但我得到了相同的結果。JSF/Facelets的:<:outputStylesheet H>標籤
不管怎麼說,這是我的 「styles.css的」:
body { width: 750px; }
#header
{
width: 100%;
font-size: 36px;
font-weight: bold;
line-height: 48px;
background-color: navy;
color: white;
}
#footer
{
width: 100%;
font-weight: bold;
background-color: navy;
color: white;
}
這是主模板 「Template.html」 包括 「header.html中」 和 「Footer.html」,在這裏我把我的「 styles.css的」使用標籤:
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<h:outputStylesheet name="css/styles.css" />
<!-- i've also tried this one, using the "library" attribute -->
<!--
<h:outputStylesheet library="css" name="styles.css" />
-->
</head>
<h:body>
<h:panelGroup id="page" layout="block">
<h:panelGroup id="header" layout="block">
<ui:insert name="header">
<ui:include src="Header.html" />
</ui:insert>
</h:panelGroup>
<h:panelGroup id="container" layout="block">
<h:panelGroup id="content" layout="block">
<ui:insert name="content">CONTENT</ui:insert>
</h:panelGroup>
</h:panelGroup>
<h:panelGroup id="footer" layout="block">
<ui:insert name="footer">
<ui:include src="Footer.html" />
</ui:insert>
</h:panelGroup>
</h:panelGroup>
</h:body>
</html>
ANF終於在這裏是我的 「Main.xhtml」,其中包括模板 「Template.html」:
<?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">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich" template="Template.html">
<h:body>
<ui:define name="content">
<h:form>
<h:inputText title="inputText"></h:inputText>
<h:commandButton value="OK"></h:commandButton>
</h:form>
</ui:define>
</h:body>
</ui:composition>
在此先感謝:)
可以ü請驗證您的瀏覽器,你的CSS具有b個een加載。 – Abhi
我該如何檢查?! – ayoubuntu
在瀏覽器中右鍵單擊頁面,*查看源代碼*和/或在Chrome/IE9/Firebug中按F12,然後選中「網絡」部分。 – BalusC