Reputation: 23
I use primefaces calendar tag to write a very short practice but cannot work and cannot popup. primefaces jar is 3.5 version.
xhtml page
<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">
<p:calendar value="#{calendarBean.date1}" pattern="yyyy/MM/dd"/>
</f:view>
Bean
private Date date1 = new Date();//can show today
private Date date1 ;//show nothing
faces-config.xml
<managed-bean>
<managed-bean-name>calendarBean</managed-bean-name>
<managed-bean-class>
com.WWUMOBPRIM.calendarBean
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
thanks,I change my code to @ManagedBean
and @SessionScoped
,
consol in chrome show "Uncaught TypeError: Cannot call method 'replace' of undefined" from primefaces-mobile.js.xhtml
Upvotes: 0
Views: 1915
Reputation: 23
I found the anwser from primefaces forum,
we should add <html>
tag and using </h:head>
<h:body>
tag to enclose our web page,
the template page like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 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">
<f:view renderKitId="PRIMEFACES_MOBILE" contentType="text/html">
<h:head>
<title>PrimeFaces Test</title>
</h:head>
<h:body>
<p:calendar />
Put other here
</h:body>
</f:view>
</html>
the page runs well ,but still have little bug in mobile version,
if <p:calendar />
enclose by <pm>
tag,
the style little difference to web version.
Upvotes: 1