Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates &引用;“找不到标签”;首次导航到页面时出现异常_Templates_Jsf_Composite Component - Fatal编程技术网

Templates &引用;“找不到标签”;首次导航到页面时出现异常

Templates &引用;“找不到标签”;首次导航到页面时出现异常,templates,jsf,composite-component,Templates,Jsf,Composite Component,我在应用程序中遇到了以下问题:在每次服务器重新启动或重新部署应用程序后,第一次尝试导航到一个特定页面将失败,并出现异常: javax.faces.view.facelets.TagException: /testing/target.xhtml @8,72 <ofc:testComp> Tag Library supports namespace: http://java.sun.com/jsf/composite/of-components, but no tag was defi

我在应用程序中遇到了以下问题:在每次服务器重新启动或重新部署应用程序后,第一次尝试导航到一个特定页面将失败,并出现异常:

javax.faces.view.facelets.TagException: /testing/target.xhtml @8,72 <ofc:testComp> Tag Library supports namespace: http://java.sun.com/jsf/composite/of-components, but no tag was defined for name: testComp
如果我删除
ui:include
一切正常。有人能给我解释一下这里发生了什么事吗?这似乎与服务器重启后初始化组件库有关,但我不明白模板中的include与此有何关系。据我所知,这是在页面中包含一些固定内容的标准方法吗?如果不应该这样做,请告诉我还有什么其他方法

谢谢



完整性方面的剩余代码片段(此处没有神奇之处):

源页面.xhtml

<ui:composition template="/testing/test_template.xhtml">
    <ui:define name="content">
        <h:outputLink value="target.xhtml">Outputlink to target</h:outputLink> <br />
        <h:commandLink value="Commandlink to target" action="target.xhtml" />
    </ui:define>
</ui:composition>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ofc="http://java.sun.com/jsf/composite/of-components"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head></h:head>
    <h:body>
        <ofc:testComp content="This is a component for testing purposes" />
    </h:body>
</html>
<html   xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:cc="http://java.sun.com/jsf/composite">

     <cc:interface>
         <cc:attribute name="content" required="true" />
     </cc:interface>

     <cc:implementation>
         <h:outputText value="#{cc.attrs.content}" />
     </cc:implementation>
 </html>

输出链接到目标
target.xhtml

<ui:composition template="/testing/test_template.xhtml">
    <ui:define name="content">
        <h:outputLink value="target.xhtml">Outputlink to target</h:outputLink> <br />
        <h:commandLink value="Commandlink to target" action="target.xhtml" />
    </ui:define>
</ui:composition>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ofc="http://java.sun.com/jsf/composite/of-components"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head></h:head>
    <h:body>
        <ofc:testComp content="This is a component for testing purposes" />
    </h:body>
</html>
<html   xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:cc="http://java.sun.com/jsf/composite">

     <cc:interface>
         <cc:attribute name="content" required="true" />
     </cc:interface>

     <cc:implementation>
         <h:outputText value="#{cc.attrs.content}" />
     </cc:implementation>
 </html>

testComp.xhtml

<ui:composition template="/testing/test_template.xhtml">
    <ui:define name="content">
        <h:outputLink value="target.xhtml">Outputlink to target</h:outputLink> <br />
        <h:commandLink value="Commandlink to target" action="target.xhtml" />
    </ui:define>
</ui:composition>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ofc="http://java.sun.com/jsf/composite/of-components"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head></h:head>
    <h:body>
        <ofc:testComp content="This is a component for testing purposes" />
    </h:body>
</html>
<html   xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:cc="http://java.sun.com/jsf/composite">

     <cc:interface>
         <cc:attribute name="content" required="true" />
     </cc:interface>

     <cc:implementation>
         <h:outputText value="#{cc.attrs.content}" />
     </cc:implementation>
 </html>


最后,一些其他内容。xhtml只是一个随机的Hello World页面。

花了相当长的时间,但我们最终成功升级了。我们现在运行的是Mojarra 2.1.21


我重新启用了include,并尽可能地恢复原始设置。我没有得到任何错误。代码在其他地方也发生了变化,所以我不能绝对肯定这是它工作的唯一原因。然而,最初的问题是可重复的,一般的设置基本上与以前相同,所以我很确定许多跳过的Mojarra版本中有一个成功了。

基本上你是说你的
不工作,不是吗?这也是错误跟踪所暗示的。我从未使用过此类组件,但请确保它们位于您的webapp/resources/of components路径中。这就是这个相关链接所说的,基本上,我要说的是,组件在几乎所有情况下都能正常工作。它们位于正确的位置,没有错误地找到并显示。真正的应用程序已经使用它们很多年了。只有这一个导航场景出现问题。为了排除其中一个,我会尝试Mojarra 2.1.17。唯一列出的版本是2.1.16。我们将对此进行检查,但可能需要几天时间(服务器配置人员很忙;)