Java 未找到JSF 2.1.13自定义组件:标记库支持命名空间:<;namsepace>;但没有为名称定义标记:<;复合成分>; 问题

Java 未找到JSF 2.1.13自定义组件:标记库支持命名空间:<;namsepace>;但没有为名称定义标记:<;复合成分>; 问题,java,jsf-2,composite-component,mojarra,Java,Jsf 2,Composite Component,Mojarra,我正在使用jsf2.1.13创建一个原型,演示JSF相对于当前使用JSP和struts1.1构建的webapp的优势。我使用jsf2.2.6编写了以下代码,但一旦发现oracleweblogic12c还不支持jsf2.2,我就不得不降级了。使用2.1.13运行代码时,我收到以下错误: /pages/sites/tab-details.xhtml @27,90 <ccc:codedType> Tag Library supports namespace: http://java.sun

我正在使用
jsf2.1.13
创建一个原型,演示JSF相对于当前使用
JSP
struts1.1
构建的webapp的优势。我使用
jsf2.2.6
编写了以下代码,但一旦发现oracleweblogic12c还不支持jsf2.2,我就不得不降级了。使用2.1.13运行代码时,我收到以下错误:

/pages/sites/tab-details.xhtml @27,90 <ccc:codedType> Tag Library supports namespace: http://java.sun.com/jsf/composite/ccc, but no tag was defined for name: codedType
复合组件:
webapp/WEB-INF/resources/ccc/codedType.xhtml

经过更多的挖掘,我发现是什么导致了我的错误。注意我的组件的位置:
webapp/WEB-INF/resources/ccc/codedType.xhtml
。适当的位置应该是
webapp/resources/ccc/codedType.xhtml
(root vs
WEB-INF
)。在JSF2.2中,它们允许对位置进行配置,我的
web.xml
中有以下内容:

<context-param>
  <param-name>javax.faces.WEBAPP_RESOURCES_DIRECTORY</param-name>
  <param-value>/WEB-INF/resources</param-value>
</context-param>

javax.faces.WEBAPP\u资源\u目录
/WEB-INF/资源
这就是为什么在JSF2.2中工作的原因

解决我的问题的方法是删除javax.faces.WEBAPP_RESOURCES_目录,因为它没有在JSF 2.1中使用,并将资源移动到根目录。

我最近遇到了这个错误: 确保将模板放在src../META-INF/resources/myFolder位置 并使用xmlns:tp=”引用它http://java.sun.com/jsf/composite/myFolder">
这帮助我解决了问题。

谢谢,帮了我很多忙
<?xml version="1.0" encoding="UTF-8"?>
<ui:component xmlns="http://www.w3.org/1999/xhtml"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:cc="http://java.sun.com/jsf/composite">
  <cc:interface shortDescription="Renders a CodedType">
    <cc:attribute name="value" required="true"
      shortDescription="Instance of CodedType to be properly rendered"
      type="company.prototype.uireplacement.presenter.CodedType" />
    <cc:attribute name="includeCode"
      shortDescription="Whether or not the rendeder type should include the code"
      type="boolean" default="false"/>
  </cc:interface>

  <cc:implementation>
    <span id="#{cc.attrs.id}">#{cc.attrs.value.label}<ui:fragment rendered="#{cc.attrs.includeCode}"> (#{cc.attrs.value.code})</ui:fragment></span>
  </cc:implementation>
</ui:component>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:p="http://primefaces.org/ui"
  xmlns:ccc="http://java.sun.com/jsf/composite/ccc">

      <ccc:codedType value="#{siteControllerBean.selectedSite.type}" includeCode="true"/>
</ui:composition>
<context-param>
  <param-name>javax.faces.WEBAPP_RESOURCES_DIRECTORY</param-name>
  <param-value>/WEB-INF/resources</param-value>
</context-param>