I have troubles with getting access to file css. My directory structure:
/resources/style/style.css
/resources/faces/template/baseLayout.xhtml
/WEB-INF/web.xml
/WEB-INF/faces-config.xml
I tried 2 ways to getting access from template page baseLayout.xhtml:
1)
<link
href="#{facesContext.externalContext.requestContextPath}/resources/style/style.css"
rel="stylesheet" type="text/css" />
2)<h:outputStylesheet library="style" name="style.css" />
But both variants doesn't work. Servlet-mapping in Web.xml
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
baseLayout.xhtml
<?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">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<h:outputStylesheet library="style" name="style.css"></h:outputStylesheet>
</h:head>
<body id="newsManagement">
<ui:composition>
<div id="allContent">
<div id="header">
<ui:insert name="header">
<ui:include src="header.xhtml"></ui:include>
</ui:insert>
</div>
<div id="menu">
<ui:insert name="menu">
<ui:include src="menu.xhtml"></ui:include>
</ui:insert>
</div>
<div id="body">
<span id="newsLoc">
<span id="newsLocWord">
<h:outputText value="#{msg['body.news']}"> </h:outputText>
</span>
<h:outputText value="#{msg['body.signs']}"> </h:outputText>
</span>
<ui:insert name="body" />
</div>
</div>
</ui:composition>
</body>
</html>
index.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<head>
</head>
<body>
<ui:composition template="/resources/faces/template/baseLayout.xhtml"> </ui:composition>
</body>
</html>
Could somebody help me?