简体   繁体   English

Eclipse + JSF + Facelets +复合组件= CANNOT_FIND_FACELET_TAGLIB

[英]Eclipse + JSF + Facelets + composite component = CANNOT_FIND_FACELET_TAGLIB

I'm trying to add a composite component to my JSF Facelets application. 我正在尝试将复合组件添加到我的JSF Facelets应用程序中。

The composite component (email.xhtml) is as follows: 复合组件(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>

The using page (emailuserpage.xhtml) is as follows: 使用页面(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>

The path to my composite component is src/main/webapp/resources/emcomp/email.xhtml . 我的复合组件的路径是src/main/webapp/resources/emcomp/email.xhtml The path to my user page is src/main/webapp/emailuserpage.xhtml . 我的用户页面的路径是src/main/webapp/emailuserpage.xhtml

But I get both compile time and run time warnings in emailuserpage.xhtml, and nothing (besides a warning message) gets displayed in the browser 但我在emailuserpage.xhtml中得到了编译时和运行时警告,并且浏览器中没有显示任何内容(除了警告消息)

Compile time warning shown in Eclipse JSF HTML editor: 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

Run time warning shown in Eclipse browser (javax.faces.PROJECT_STAGE=Development in web.xml): Eclipse浏览器中显示的运行时警告(javax.faces.PROJECT_STAGE = web.xml中的开发):

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.

I've already seen this question (it didn't solve the problem): NLS missing message: CANNOT_FIND_FACELET_TAGLIB 我已经看到了这个问题(它没有解决问题): NLS缺少消息:CANNOT_FIND_FACELET_TAGLIB

I'm using the m2e and m2e-wtp plug-ins, with Eclipse version: 我正在使用m2em2e-wtp插件,使用Eclipse版本:

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

Any ideas on what I'm doing incorrectly? 关于我做错的任何想法? Have I included the composite component incorrectly somehow, or am I using the wrong directories to store my resources? 我是否以某种方式错误地包含了复合组件,或者我使用了错误的目录来存储我的资源? Is this an Eclipse/configuration problem? 这是Eclipse /配置问题吗?

[EDIT] [编辑]

In response to Daniel's comment 回应丹尼尔的评论

SOURCE directory structure: SOURCE目录结构:

  • project/src/main/ 项目/ src目录/主/
    • java/ 的Java /
    • webapp/ Web应用程序/

DEPLOY directory structure: DEPLOY目录结构:

  • project 项目
    • HTML files HTML文件
    • resources/ (including emcomp/ folder) 资源/(包括emcomp /文件夹)
    • META-INF/ META-INF /
    • WEB-INF/ (config files and lib/ folder) WEB-INF /(配置文件和lib /文件夹)

从XML名称空间URI中删除尾部斜杠。

xmlns:em="http://java.sun.com/jsf/composite/emcomp"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM