繁体   English   中英

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

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

我正在尝试将复合组件添加到我的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浏览器中显示的运行时警告(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.

我已经看到了这个问题(它没有解决问题): NLS缺少消息:CANNOT_FIND_FACELET_TAGLIB

我正在使用m2em2e-wtp插件,使用Eclipse版本:

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

关于我做错的任何想法? 我是否以某种方式错误地包含了复合组件,或者我使用了错误的目录来存储我的资源? 这是Eclipse /配置问题吗?

[编辑]

回应丹尼尔的评论

SOURCE目录结构:

  • 项目/ src目录/主/
    • 的Java /
    • Web应用程序/

DEPLOY目录结构:

  • 项目
    • HTML文件
    • 资源/(包括emcomp /文件夹)
    • META-INF /
    • 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