
无论如何,这里是我的“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>
提前致谢 :)
解决方法 < h:outputStylesheet> (和< h:outputScript>)需要< h:head>,但是你有< head>。相应地修复它。<h:head> <h:outputStylesheet name="CSS/styles.CSS" /></h:head>
此外,您需要确保将CSS / styles.CSS文件放在public webcontent的/ resources子文件夹中。
WebContent |-- resources | `-- CSS | `-- styles.CSS :
至于您尝试使用库属性,请小心,在此上下文中使用library =“CSS”并不完全正确。参见:What is the JSF resource library for and how should it be used?
总结以上是内存溢出为你收集整理的html – JSF/Facelets:使用标签不能识别CSS文件全部内容,希望文章能够帮你解决html – JSF/Facelets:使用标签不能识别CSS文件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)