title: How to get access to file css in JSF 2.0
body: <p>I have troubles with getting access to  file css.
  My directory structure:</p>
  
  <pre><code>/resources/style/style.css
  /resources/faces/template/baseLayout.xhtml
  /WEB-INF/web.xml
  /WEB-INF/faces-config.xml
  </code></pre>
  
  <p>I tried 2 ways to getting access from template page baseLayout.xhtml:</p>
  
  <p>1) </p>
  
  <pre><code>&lt;link
  href="#{facesContext.externalContext.requestContextPath}/resources/style/style.css"
  rel="stylesheet" type="text/css" /&gt;
  </code></pre>
  
  <p>2)<code>&lt;h:outputStylesheet library="style" name="style.css" /&gt;</code></p>
  
  <p>But both variants doesn't work.
  <strong>Servlet-mapping in Web.xml</strong></p>
  
  <pre><code>&lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p><strong>baseLayout.xhtml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"&gt;
      &lt;h:head&gt;
          &lt;h:outputStylesheet library="style" name="style.css"&gt;&lt;/h:outputStylesheet&gt;
      &lt;/h:head&gt;
  
  &lt;body id="newsManagement"&gt;
      &lt;ui:composition&gt;
          &lt;div id="allContent"&gt;
              &lt;div id="header"&gt;
                  &lt;ui:insert name="header"&gt;
                      &lt;ui:include src="header.xhtml"&gt;&lt;/ui:include&gt;
                  &lt;/ui:insert&gt;
              &lt;/div&gt;
              &lt;div id="menu"&gt;
                  &lt;ui:insert name="menu"&gt;
                      &lt;ui:include src="menu.xhtml"&gt;&lt;/ui:include&gt;
                  &lt;/ui:insert&gt;
              &lt;/div&gt;
              &lt;div id="body"&gt;
                  &lt;span id="newsLoc"&gt; 
                      &lt;span id="newsLocWord"&gt;
                          &lt;h:outputText value="#{msg['body.news']}"&gt; &lt;/h:outputText&gt;          
                      &lt;/span&gt;
                      &lt;h:outputText value="#{msg['body.signs']}"&gt; &lt;/h:outputText&gt; 
                  &lt;/span&gt;
                  &lt;ui:insert name="body" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/ui:composition&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>index.xhtml</strong></p>
  
  <pre><code>&lt;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"&gt;
      &lt;head&gt;
  
      &lt;/head&gt;
      &lt;body&gt;
          &lt;ui:composition template="/resources/faces/template/baseLayout.xhtml"&gt; &lt;/ui:composition&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Could somebody help me?</p>