Jsf 2 JSF 2.1 PrimeFaces Mobile 0.9.4日历不工作

Jsf 2 JSF 2.1 PrimeFaces Mobile 0.9.4日历不工作,jsf-2,rendering,stylesheet,primefaces-mobile,Jsf 2,Rendering,Stylesheet,Primefaces Mobile,我正在使用jsf 2.1、primefaces 3.5和primefaces mobile 0.9.4尝试primefaces mobile Calendar.jsf示例。我是否必须自己为日历提供样式表,或者可以从primefaces中提取样式表。下面是我现在使用的代码 段.xhtml <f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xml

我正在使用jsf 2.1、primefaces 3.5和primefaces mobile 0.9.4尝试primefaces mobile Calendar.jsf示例。我是否必须自己为日历提供样式表,或者可以从primefaces中提取样式表。下面是我现在使用的代码

段.xhtml

<f:view xmlns="http://www.w3.org/1999/xhtml"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui"
        xmlns:pm="http://primefaces.org/mobile"        
        contentType="text/html"
        renderKitId="PRIMEFACES_MOBILE">

<f:facet name="postinit">            
          <link rel="stylesheet" href="#{request.contextPath}/javax.faces.resource/calendar/calendar.css.jsf?ln=primefaces-mobile" />
            <h:outputScript library="primefaces-mobile" name="calendar/calendar.js" />            

            <script type="text/javascript">
                (function($) {
                    $.mobiscroll.i18n['pt_BR'] = $.extend($.mobiscroll.i18n['pt_BR'], {
                        dateFormat: 'dd/mm/yy',
                        dateOrder: 'ddMMyy',
                        dayNames: ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'],
                        dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
                        dayText: 'Dia',
                        hourText: 'Hora',
                        minuteText: 'Minutos',
                        monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
                        monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
                        monthText: 'Mês',
                        secText: 'Segundo',
                        timeFormat: 'HH:ii',
                        timeWheels: 'HHii',
                        yearText: 'Ano',
                        setText: 'Selecionar',
                        cancelText: 'Cancelar',
                        nowText: 'Agora'
                    });
                })(jQuery);
            </script>
        </f:facet>   

<pm:page id="page" title="Calendar">  
<pm:view id="menu">
<pm:content>
 <p:calendar value="#{calendarBean.date1}" pattern="MM/dd/yyyy HH:mm" /> 
</pm:content>
        </pm:view>
    </pm:page>     
</f:view>

  • 下载PrimeFaces Mobile 0.9.5.jar并将其添加到项目中的库中
  • 使用上面的代码编辑segment.xhtml
  • GET http://localhost:8080/javax.faces.resource/calendar/calendar.css.jsf?ln=primefaces-mobile 404 (Not Found) segments.xhtml:3
    GET http://localhost:8080/RES_NOT_FOUND 404 (Not Found) segments.xhtml:3
    Uncaught TypeError: Cannot read property 'i18n' of undefined segments.xhtml:7
    Uncaught TypeError: Cannot call method 'replace' of undefined primefaces-mobile.js.xhtml:1
    
    <f:facet name="postinit">
    <link rel="stylesheet" href="#{request.contextPath}/javax.faces.resource/calendar/calendar.css.jsf?ln=primefaces-mobile" />  
     <h:outputScript library="primefaces-mobile" name="calendar/calendar.js" /> 
    </f:facet>