0

シンプルな JSF アプリケーションを構築しようとしていますが、以下のコードを使用して template/basic.xhtml に css を追加すると、アプリケーション サーバー (Tomcat 7 と Glassfish 4 の両方) が 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>

index.xhtml には単純に含まれています

<!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>

別のいくつかの投稿と、特定のディレクトリに css を配置する必要があるMkyong の JSF チュートリアルを読みましたが、それでも機能しませんでした。

私のファイルが置かれている場所は次のとおりです。

enrollment/index.xhtml
enrollment/WEB-INF/templates/basic.xhtml
enrollment/resources/common/css/reset.css
enrollment/resources/common/css/common.css

それを機能させるために欠落していた他の構成はありますか?

null ResourceInfo が生成されて返されるスタックで見つけたものを次に示します。

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 は、提供された 4 つのパラメーターを使用して HashMap を検索します。

ResourceInfo info = getFromCache(resourceName, libraryName, localePrefix, contracts);

HashMap のすべての値を調べましたが、リソースは 2 つしかありません。

"/"
"/WEB-INF/templates/basic.xhtml"

リソースがハッシュマップに追加されないため、これがおそらく原因です

4

1 に答える 1