Calendar not popping PrimeFaces
I am trying to add the Calendar effect (using Primeface) to my JSF web page. i am using Netbeans 6.9.1 and glassfish 3.1.
I installed Primeface to my application as described in this blog
And copied some code from Primefaces website. I copied the entire form and pasted it on my xhtml file. and i changed the bean class accordingly.
I am not ge开发者_JAVA百科tting the Calendar pop up in my web page. Why is this happening. I tested this on Chrome and Firefox still no luck. Can someone help me
First, ensure that you've declared the PrimeFaces tag library in your XML namespace. For the current PrimeFaces 2.x version, that is
xmlns:p="http://primefaces.prime.com.tr/ui"
Second, PrimeFaces comes along with a lot of CSS/JS resources which are supposed to be auto-included by a <h:head>
. The calendar component (and many others) are styled and activated by exactly those resources. So, in order to get them to auto-included, you need to ensure that you've a <h:head>
instead of <head>
in your master template. And to be consistent, replace <body>
by <h:body>
as well.
Update based on the comments, there was a JavaScript conflict. The <p:calendar>
works fine at its simplest form. It ceased to work because you've a jQuery menubar in your template which in turn would require a <script src="jquery.js">
. Since PrimeFaces already ships with jQuery bundled, it has most likely conflicted with the manual jQuery script include. You need to get rid of the manual jQuery script include.
When you use the jquery datepicker widget and I assume also the calendar widgit you can set the regional parameter to use date formats of a particular country.
For example:
$.datepicker.setDefaults( $.datepicker.regional[ "en-GB" ] );
If you do this you must include the appropriate definitions, e.g.
<script type="text/javascript" src="js/datepicker-en-GB.js"></script>
精彩评论