4

JSF Facelets アプリケーションに複合コンポーネントを追加しようとしています。

複合コンポーネント (email.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:composite="http://java.sun.com/jsf/composite"
    xmlns:h="http://java.sun.com/jsf/html">

<h:head>
    <title>This content will not be displayed</title>
</h:head>
<h:body>
    <composite:interface>
        <composite:attribute name="value" required="false" />
    </composite:interface>

    <composite:implementation>
        <h:outputLabel value="Email id: "></h:outputLabel>
        <h:inputText value="#{cc.attrs.value}"></h:inputText>
    </composite:implementation>
</h:body>
</html>

使用ページ(emailuserpage.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:h="http://java.sun.com/jsf/html"
    xmlns:em="http://java.sun.com/jsf/composite/emcomp/">

<h:head>
    <title>Using a sample composite component</title>
</h:head>

<body>
    <h:form>
        <em:email value="my@email.address" />
    </h:form>
</body>
</html>

複合コンポーネントへのパスはsrc/main/webapp/resources/emcomp/email.xhtml. 私のユーザーページへのパスはsrc/main/webapp/emailuserpage.xhtml.

しかし、emailuserpage.xhtml でコンパイル時と実行時の両方の警告が表示され、ブラウザーには (警告メッセージ以外に) 何も表示されません。

Eclipse JSF HTML エディターに表示されるコンパイル時の警告:

xmlns:em="http://java.sun.com/jsf/composite/emcomp/"
NLS missing message: CANNOT_FIND_FACELET_TAGLIB in: 
 org.eclipse.jst.jsf.core.validation.internal.facelet.messages

Eclipse ブラウザーに表示される実行時の警告 (web.xml の javax.faces.PROJECT_STAGE=Development):

Warning: The page /emailuserpage.xhtml declares namespace http://java.sun.com/jsf/composite/emcomp/ and uses the tag em:email , but no TagLibrary associated to namespace.

私はすでにこの質問を見てきました (問題は解決しませんでした): NLS missing message: CANNOT_FIND_FACELET_TAGLIB

私はm2eとのm2e-wtpプラグインを Eclipse バージョンで使用しています。

Eclipse Java EE IDE for Web Developers
Version: Indigo Service Release 2
Build id: 20120216-1857

私が間違っていることについてのアイデアはありますか? なんらかの方法で複合コンポーネントを誤って含めたのでしょうか、それともリソースを格納するために間違ったディレクトリを使用していますか? これは Eclipse/構成の問題ですか?

[編集]

ダニエルのコメントに応えて

SOURCE ディレクトリ構造:

  • プロジェクト/ソース/メイン/
    • ジャバ/
    • webapp/

DEPLOY ディレクトリ構造:

  • 事業
    • HTML ファイル
    • resources/ (emcomp/ フォルダーを含む)
    • メタINF/
    • WEB-INF/ (設定ファイルと lib/ フォルダー)
4

1 に答える 1

4

XML 名前空間 URI から末尾のスラッシュを削除します。

xmlns:em="http://java.sun.com/jsf/composite/emcomp"
于 2012-04-18T13:17:52.413 に答える