简体   繁体   English

找不到JSF 2.1.13自定义组件:标签库支持命名空间: <namsepace> 但没有为名称定义标签: <compositecomponent>

[英]JSF 2.1.13 custom component not found: Tag Library supports namespace: <namsepace> but no tag was defined for name: <compositecomponent>

Problem 问题

I am using JSF 2.1.13 to create a prototype to demostrate the benefits of JSF over our current webapp built with JSP and struts 1.1 . 我正在使用JSF 2.1.13创建一个原型来展示JSF对我们当前使用JSPstruts 1.1构建的webapp的好处。 I following code using works with JSF 2.2.6 , but I had to down grade once I found out that Oracle Weblogic 12c doesn't support JSF 2.2 yet. 我使用JSF 2.2.6代码跟踪代码,但是一旦我发现Oracle Weblogic 12c还不支持JSF 2.2,我就不得不降级。 When running the code with 2.1.13 I receive the following error: 使用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

Googling only pointed me to a bug about nested composite components , but that isn't something I'm doing. 谷歌搜索只指向我有关嵌套复合组件错误 ,但这不是我正在做的事情。

Code

Excerpt from pom.xml 摘录自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 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>

Page using composite component: webapp/pages/sites/tab-details.xhtml 使用复合组件的webapp/pages/sites/tab-details.xhtmlwebapp/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>

After more digging I found what caused my error. 经过多次挖掘后,我发现了导致我错误的原因。 Note the location of my compontent: webapp/WEB-INF/resources/ccc/codedType.xhtml . 请注意我的组件的位置: webapp/WEB-INF/resources/ccc/codedType.xhtml The appropriate location should be webapp/resources/ccc/codedType.xhtml (root vs WEB-INF ). 适当的位置应该是webapp/resources/ccc/codedType.xhtml (root vs WEB-INF )。 In JSF 2.2, they allowed the location to be configurable and I had the following in my web.xml : 在JSF 2.2中,他们允许位置可配置,我在web.xml有以下内容:

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

which is why things worked in JSF 2.2. 这就是为什么事情在JSF 2.2中有效。

The fix for my situation was to remove javax.faces.WEBAPP_RESOURCES_DIRECTORY since it isn't used in JSF 2.1 and move the resources to the root. 我的情况的修复是删除javax.faces.WEBAPP_RESOURCES_DIRECTORY因为它没有在JSF 2.1中使用并将资源移动到根目录。

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

暂无
暂无

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

相关问题 <my:foo>标记库支持命名空间:http://java.sun.com/jsf/composite/mycomponents,但没有为name定义标记:foo - <my:foo> Tag Library supports namespace: http://java.sun.com/jsf/composite/mycomponents, but no tag was defined for name: foo <h:outputtext>标签库支持命名空间:http://java.sun.com/jsf/html,但没有为名称定义标签:outputtext - <h:outputtext> Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: outputtext NETBEANS 7.4:“未为名称定义任何标记:注册” +“未为命名空间http://java.sun.com/jsf/composite/my_composite_component找到库” - NETBEANS 7.4: “no tag was defined for name: register” + “No library found for namespace http://java.sun.com/jsf/composite/my_composite_component” <p:lineChart>标记库支持名称空间:http://primefaces.org/ui,但未为名称定义任何标记:lineChart - <p:lineChart> Tag Library supports namespace: http://primefaces.org/ui, but no tag was defined for name: lineChart jsf 2.0 自定义组件/标签非复合 - jsf 2.0 Custom Component/Tag NOT COMPOSITE Jsf 2.0自定义标签 - Jsf 2.0 Custom Tag JSF 2.2-找不到“链接”标签 - JSF 2.2 - No “link” tag found 将JSP标记转换为JSF组件 - Converting A JSP Tag To A JSF Component Springboot GSP-标签[form]不存在。 找不到名称空间的标签库:g - Springboot GSP - Tag [form] does not exist. No tag library found for namespace: g 具有JSF主体的JSP自定义标签 - JSP Custom tag with JSF body
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM