JSF PrimeFaces P:日历或P:datePicker未显示任何日历字段

发布于 2025-01-25 18:37:11 字数 2425 浏览 2 评论 0原文

我正在使用JSF PrimeFaces 版本8 ,并尝试在XHTML页面中显示日历字段。但是,在所有努力中,弹出日历字段根本没有在页面中显示。

我的 main.xhtml 页面包含AP:对话框,此对话框包含另一个XHTML页面, dateedit.xhtml 。在第二个XHTML中,我试图拥有p:datePickerp:calendar字段。但是它不起作用。

以下是我的主体中的代码片段:xhtml页面:

<p:dialog closable="true" visible="false" modal="true" id="dateDialog" widgetVar="dateDialog" resizable="false" showEffect="fade" hideEffect="fade"
            header="Date Edit" width="60%" height="50%" style="max-height:100%; overflow:auto; ">
            <ui:include src="dateEdit.xhtml" >
            </ui:include> 
        </p:dialog>

以下是dateedit.xhtml的代码段:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" >
    
<h:head>
    <f:facet name="last">
        <link type="text/css" rel="stylesheet" href="../jsfStyle.css" media="all"></link>
    </f:facet>
</h:head>
<h:body>

        <h:form id="formDtId" enctype="multipart/form-data" method="post" >

<p:outputPanel id="editProjectInfo">
            <h:panelGrid id="coreGrid" columns="3" style="margin-bottom:10px" cellpadding="7">
<p:outputLabel for="update_Date" value="Demo&nbsp;Date : " />
                <p:calendar id="update_Date" value="#{dateManagedBean.demoDate}" mode="popup" navigator="true" pattern="yyyy-MM-dd" style="font-size:8pt;" showOn="button" >
                    <f:convertDateTime type="date" pattern="yyyy-MM-dd" for="update_Date"></f:convertDateTime>
                </p:calendar>
</h:panelGrid>
        </p:outputPanel>
        
        </h:form>
        
</h:body>
</html>

但是,如果我单击按钮图标,则不会显示任何日历。什么都没有发生。

我还尝试了以下代码,而不是p:日历,但这也没有用:

<p:datePicker id="update_Date" value="#{dateManagedBean.demoDate}" pattern="MM-dd-yyyy" showIcon="true" />

请帮助解决此问题。谢谢。

I am using Jsf primefaces version 8 and trying to show the calendar field in the xhtml page. But inspite all efforts, the popup calendar field is not displaying at all in the page.

My main.xhtml page contains a p:dialog and this dialog includes another xhtml page, dateEdit.xhtml. Inside the second xhtml, I am trying to have the p:datePicker or p:calendar field. But its not working.

Below is the piece of code from my main.xhtml page:

<p:dialog closable="true" visible="false" modal="true" id="dateDialog" widgetVar="dateDialog" resizable="false" showEffect="fade" hideEffect="fade"
            header="Date Edit" width="60%" height="50%" style="max-height:100%; overflow:auto; ">
            <ui:include src="dateEdit.xhtml" >
            </ui:include> 
        </p:dialog>

Below is the code snippet from the dateEdit.xhtml :

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" >
    
<h:head>
    <f:facet name="last">
        <link type="text/css" rel="stylesheet" href="../jsfStyle.css" media="all"></link>
    </f:facet>
</h:head>
<h:body>

        <h:form id="formDtId" enctype="multipart/form-data" method="post" >

<p:outputPanel id="editProjectInfo">
            <h:panelGrid id="coreGrid" columns="3" style="margin-bottom:10px" cellpadding="7">
<p:outputLabel for="update_Date" value="Demo Date : " />
                <p:calendar id="update_Date" value="#{dateManagedBean.demoDate}" mode="popup" navigator="true" pattern="yyyy-MM-dd" style="font-size:8pt;" showOn="button" >
                    <f:convertDateTime type="date" pattern="yyyy-MM-dd" for="update_Date"></f:convertDateTime>
                </p:calendar>
</h:panelGrid>
        </p:outputPanel>
        
        </h:form>
        
</h:body>
</html>

But if I click on the button icon, no calendar is getting displayed. Nothing is happening.

enter image description here

I tried with the below code also, instead of p:calendar, but that also didn't work :

<p:datePicker id="update_Date" value="#{dateManagedBean.demoDate}" pattern="MM-dd-yyyy" showIcon="true" />

Kindly help to resolve this issue. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文