0
votes

Iam using primefaces in my project and everything works fine except p:calendar component of Primefaces.The following xhtml file doesn't show up the calendar component.

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/Templates/Commons/MainContent.xhtml">
    <ui:define name="main_content"> 
        <h:body>
        <h:form>
            <p:calendar value="#{controller.data}" pattern="dd/MM/yyyy" />
        </h:form>
        </h:body>
    </ui:define> 
</ui:composition>

However if I remove ui:compisition ,as the following snippet shows,it works fine.

<html xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">
        <h:body>
        <h:form>
            <p:calendar value="#{controller.data}" pattern="dd/MM/yyyy" />
        </h:form>
        </h:body>
</html>

Is there anything I should know about ui:compisition and p:calendar?

1
Did you check with including MainContent.xhtml file in second way?Qadir Hussain
@QadirHussain Doesn't work either.Yishagerew
what about posting your stack trace ?Scorpion
Can you post your MainContent.xhtml? Are you sure that the path to this template is correct?Multisync
@Multisync Everything is displayed from the template including other Primefaces components except p:calendar component.Yishagerew

1 Answers

0
votes

I think that if you use this template it may helps you

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="/WEB-INF/Templates/Commons/MainContent.xhtml">
      <ui:define name="main_content">
         <h:body>
            <h:form>
                <p:calendar value="#{controller.data}" pattern="dd/MM/yyyy" />
            </h:form>
        </h:body>
      </ui:define>
    </ui:composition>
</html>

follow this structure.