0

別のネストされたテンプレートを含むテンプレートの使用に問題があります。

私は得る

 java.io.FileNotFoundException
at     org.apache.naming.resources.DirContextURLConnection.getInputStream(DirContextURLConnection.java:403)

私はこの基本的なテンプレートを持っています:

(./resources/css/template.xhtml)
<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">

<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <h:outputStylesheet library="css" name="stylesheet.css"/>
    <title><ui:insert name="title"> Facelets template </ui:insert></title>
</h:head>
<h:body>
    <div id="top" class="top_content">
       <ui:insert name="top">Top</ui:insert>
    </div>
    <div>            
    <div id="content" class="center_content">
        <ui:insert name="content">Content</ui:insert>
    </div>
    </div>        
</h:body>

テンプレートを「継承」する templateLogin :

(./resources/css/templateLogin.xhtml)

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
template="./resources/css/template.xhtml">
        <ui:define name="title">
            Some title
        </ui:define>
        <ui:define name="top">
            <div id="top">
                   ...code here
             </div>
        </ui:define>
</ui:composition>

そして、templateLogin を使用する Web アプリケーションのウェルカム ファイルであるウェルカム ファイルがあります。

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:h="http://java.sun.com/jsf/html"
            template="./resources/css/templateLogin.xhtml">
<ui:define name="title">
    Welcome title
</ui:define>

私が言ったように、ファイルが見つからないという例外が発生します。ウェルカム ファイルのテンプレート template.xhtml として定義すると、エラーは発生しません。指定されたパスに templateLogin.xhtml が表示されないためですが、確実に存在します。

何か案は?ありがとう。

4

3 に答える 3