Eclipse + JSF + Facelets + composite component = CANNOT_FIND_FACELET_TAGLIB

composite-component, eclipse, facelets, java, jsf-2

Solution

Remove the trailing slash from the XML namespace URI.

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

Problem

I'm trying to add a composite component to my JSF Facelets application. The composite component (email.xhtml) is as follows: ``` <!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: ``` <!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`. The path to my user page is `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 Compile time warning shown in Eclipse JSF HTML editor: ``` 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): ``` 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 I'm using the `m2e` and `m2e-wtp` plug-ins, with Eclipse version: ``` 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? [EDIT] In response to Daniel's comment SOURCE directory structure: - project/src/main/ - java/ - webapp/ DEPLOY directory structure: - project - HTML files - resources/ (including emcomp/ folder) - META-INF/ - WEB-INF/ (config files and lib/ folder)

Original source

Related problems