错误 JSF 元素 "t:document" 的前缀 "t" 未绑定。使用 org.apache.myfaces

Error JSF The prefix "t" for element "t:document" is not bound. Use org.apache.myfaces

最近我添加了不同的范围代码以更好地执行 jsf 生命周期。 访问 jsf 页面时在运行时出错。发生什么事了?

Web.xml 文件:

<context-param>
     <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
     <param-value>org.apache.myfaces.component.html.util.StreamingAddResource</param-value>
</context-param>

jsf (xhtml) 文件:

<?xml version='1.0' encoding='UTF-8' ?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"
    xmlns:p="http://primefaces.org/ui" xmlns:tjfw="http://tjfw.tjba.jus.br/tjfw/jsf/components/ui"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    template="/WEB-INF/templates/main.xhtml">

<ui:define name="contents"
 <f:view>
         <t:document>
         <t:documentHead>
         ...
         <title>example</title>
         ...
         </t:documentHead>
         <t:documentBody>
         ...
         </t:documentBody>
         </t:document>
     </f:view>  

</ui:define>
</ui:composition>

控制台错误:

09:40:39,476 FATAL [org.jboss.seam.faces.view.SeamViewMetadata] Error Parsing /resources/pages/objectPearson/pearson.xhtml: Error Traced[line: 188] The prefix "t" for element "t:document" is not bound.

我想如果你不包括库和分配的前缀 (xmlns:t),你就不能使用它。

根据@Jesper

您正在尝试访问一个您没有声明在何处找到它的库。

此 't' 是您未声明的命名空间。

示例: 在这里你使用 <f:view> 而这个 'f' 是这个 URL 的命名空间:

xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"

所以您使用的是未定义的命名空间,请查看此命名空间 't'

的 URL

试试这个:

xmlns:t="http://myfaces.apache.org/tomahawk"