I am trying to build a simple JSF application, but when I add css in the template/basic.xhtml using the code below, application server (both tomcat 7 and glassfish 4) resolve to RES_NOT_FOUND
<h:head>
<title><ui:insert name="title">Enrollment System</ui:insert></title>
<h:outputStylesheet library="common" name="css/reset.css" />
<h:outputStylesheet library="common" name="css/common.css" />
</h:head>
The index.xhtml contains simply
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="/templates/basic.xhtml">
<ui:define name="content">
<h1>Welcome, #{loginSession.privilege}</h1>
</ui:define>
</ui:composition>
</html>
I've read another few posts and also Mkyong's JSF tutorial that I should put css in some specific directory, but still failed to make it work.
Here are locations of where my files are put at:
enrollment/index.xhtml
enrollment/WEB-INF/templates/basic.xhtml
enrollment/resources/common/css/reset.css
enrollment/resources/common/css/common.css
Is there any other config that was missing to make it work?
Here is what I find in the stack which the null ResourceInfo is generated and returned.
Daemon Thread [http-bio-80-exec-3] (Suspended)
owns: SocketWrapper<E> (id=62)
ResourceManager.findResource(String, String, String, boolean, FacesContext) line: 190
ResourceManager.findResource(String, String, String, FacesContext) line: 180
ResourceHandlerImpl.createResource(String, String, String) line: 201
ResourceHandlerImpl.createResource(String, String) line: 181
StylesheetRenderer.encodeEnd(FacesContext, UIComponent) line: 97
getFromCache will search in a HashMap using the four parameter provided.
ResourceInfo info = getFromCache(resourceName, libraryName, localePrefix, contracts);
I've examine all the values in the HashMap, there is only two resources namely
"/"
"/WEB-INF/templates/basic.xhtml"
This probably is the cause as the resources are never added to the hashmap