Java – JSF 2.1.0 not found 13 custom component: tag library supports namespace: but no tag is defined for Name:

problem

I am using JSF 2.1 Create a prototype to demonstrate the benefits of JSF to the webapp we currently build using JSP and struts 1.1 I use JSF 2.2 6 code tracking code, but once I find that Oracle Weblogic 12C does not support JSF 2.2, I have to downgrade Use 2.1 13 the following error was received while running the code:

/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

Google search only points to my bug about nested composite components, but that's not what I'm doing

code

Excerpt from POM xml

<!-- JSF Dependencies -->
<dependency>
  <groupId>com.sun.faces</groupId>
  <artifactId>jsf-api</artifactId>
  <version>2.1.13</version>
</dependency>
<dependency>
  <groupId>com.sun.faces</groupId>
  <artifactId>jsf-impl</artifactId>
  <version>2.1.13</version>
</dependency>

Composite Compontent:webapp / WEB-INF / resources / ccc / codedType. xhtml

<?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>

Pages using composite components: webapp / pages / sites / tab details xhtml

<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>

Solution

After digging many times, I found the cause of my mistake Please note the location of my component: webapp / WEB-INF / resources / CCC / codedtype xhtml. The appropriate location should be webapp / resources / CCC / codedtype xhtml(root vs WEB-INF). In JSF 2.2, they allow location configurable, and I'm on the web XML contains the following:

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

That's why things work in JSF 2.2

The fix for my situation is to delete javax faces. WEBAPP_ RESOURCES_ Directory because it is not used in JSF 2.1 and moves resources to the root

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>