当 dynamic 设置为 true 时,Primefaces 日历无法在不同的选项卡中工作

Primefaces Calendar not working in different Tabs when dynamic is set true

我正在尝试设计两个单独的日历 tabs.I 导航到不同的选项卡后无法打开日历弹出窗口 Main.xhtml(标签的设计位置)

    <p:tabView id="CRE_CI" widgetVar="TabV" prependId="false" cache="false" dynamic="true">
    <p:tab title="CRE Residential Input" style="outline: 0;">
    <ui:include src="CRE//abc.xhtml" />
    </p:tab>
    <p:tab title="CRE Commercial Analysis" style="outline: 0;">
    <ui:include src="CRE//xyz.xhtml" />
    </p:tab>
    </p:tabView>

abc.xhtml

   <html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:p="http://primefaces.org/ui">
   <h:head>
   <title>Commercial Analysis</title>
    </h:head>
    <div id="CRECommAnalysis">
    <h:body>
    <h:form id="crecommform">
    <p:calendar id="commcal1" navigator="true" pattern="MM/dd/yy"style="width:100%" >
                    </p:calendar>
            </h:form>
        </h:body>
    </div>
    </html>     

xyz.xhtml

    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">
    <h:head>
    <title>Commercial Analysis</title>
    </h:head>
    <div id="CRECommA">
    <h:body>
    <h:form id="crecomm">
    <p:calendar id="commcal2"/>
    </h:form>
    </h:body>
    </div>
    </html>     

请注意,当从 Main.xhtml 中删除 dynamic="true" 时它工作正常

您构建的页面包含错误。这对我有用。

index.xhtml

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">
<h:head>
    <title>Commercial Analysis</title>
</h:head>
<h:body>
        <p:tabView id="CRE_CI" widgetVar="TabV" prependId="false"
            cache="false" dynamic="true">
            <p:tab title="CRE Residential Input" style="outline: 0;">
                <ui:include src="abc.xhtml" />
            </p:tab>
            <p:tab title="CRE Commercial Analysis" style="outline: 0;">
                <ui:include src="xyz.xhtml" />
            </p:tab>
        </p:tabView>
</h:body>
</html>

abc.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">
    <div id="CRECommAnalysis">
        <h:form id="crecommform">
            <p:calendar id="commcal1" navigator="true" pattern="MM/dd/yy"
                style="width:100%">
            </p:calendar>
        </h:form>
    </div>
</ui:composition>

xyz.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">
    <div id="CRECommA">
        <h:form id="crecomm">
            <p:calendar id="commcal2" />
        </h:form>
    </div>
</ui:composition>