Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.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 如何在ui:composition模板子级中使用f:loadBundle_Templates_Jsf 2_Facelets - Fatal编程技术网

Templates 如何在ui:composition模板子级中使用f:loadBundle

Templates 如何在ui:composition模板子级中使用f:loadBundle,templates,jsf-2,facelets,Templates,Jsf 2,Facelets,我有一个基于模板的“test.xhtml”: <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" template="/te

我有一个基于模板的“test.xhtml”:

    <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"
        template="/templates/BasicTemplate.xhtml">
        <f:loadBundle basename="label" var="label" />
...
    <h:commandButton value="#{label.buttonname}" ...></h:commandButton>
...

...
...
文件“label.properties”位于WEB-INF/classes中。 但当我将它加载到浏览器中时,并没有替换,而是在按钮上显示了“label.buttonname”,而不是预期的名称。 这个问题只有在我使用模板时才会出现。 我做错了什么?

我明白了: 这是错误的。LoadBudle位于composition和define标记之间

<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"
    template="/templates/BasicTemplate.xhtml">
    <f:loadBundle basename="label" var="label" /> <--- WRONG place!!!
    <ui:define name="content">
        <h:commandButton value="#{label.buttonname}" ...></h:commandButton>
    </ui:define>

我明白了:
这是错误的。LoadBudle位于composition和define标记之间

<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"
    template="/templates/BasicTemplate.xhtml">
    <f:loadBundle basename="label" var="label" /> <--- WRONG place!!!
    <ui:define name="content">
        <h:commandButton value="#{label.buttonname}" ...></h:commandButton>
    </ui:define>