Search code examples
jsfmyfaces

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


Recently i add the diferent scope code for better performace the jsf livecycle. Has error in runtime for acess jsf page. What happened?

Web.xml file:

<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) file:

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

Console error:

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.

Solution

  • According with @Jesper

    You are trying to acces a library that you didn't declare where to found it.

    This 't' is a namespace that you didn't daclare.

    Example: Here you use <f:view> and this 'f' is a namespace for this URL :

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

    So you are using a namespace undefined, check out the URL for this namespace 't'

    Try this:

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