我正在使用JSF2和primefaces,并且无法加载css表。
CSS存储在@WebContent / resources / css / style.css
中XHTML:
<h:head></h:head>
<h:body>
<h:outputStylesheet name="css/styles.css" />
我尝试在h:head中找到h:outputStylesheet,并尝试使用library =“css”标签无效。
输出html如下:
<head>
<link type="text/css" rel="stylesheet" href="/WireTapLogSearchUtility/faces/javax.faces.resource/theme.css?ln=primefaces-home" />
<link rel="stylesheet" media="screen" type="text/css" href="/WireTapLogSearchUtility/faces/javax.faces.resource/primefaces.css?ln=primefaces&v=3.2" />
<script type="text/javascript" src="/WireTapLogSearchUtility/faces/javax.faces.resource/jquery/jquery.js?ln=primefaces&v=3.2"><!--//-->
</script><script type="text/javascript" src="/WireTapLogSearchUtility/faces/javax.faces.resource/primefaces.js?ln=primefaces&v=3.2"><!--//-->
</script><script type="text/javascript" src="/WireTapLogSearchUtility/faces/javax.faces.resource/jsf.js?ln=javax.faces"><!--//--></script>
</head>
在源上使用ctrl + f没有style.css
的结果此外,我确实在web.xml中有映射:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>