JSF 2.0 and Primefaces with Facelets

前端 未结 1 891
半阙折子戏
半阙折子戏 2021-01-07 14:47

I\'m trying to incorporate primefaces into my JSF 2.0 web project.

I\'ve recently updated from facelets 1.x to 2.0 and Added primefaces jar to my library folder. Ev

相关标签:
1条回答
  • 2021-01-07 15:31

    In your template.xhtml, you need to replace <head> by <h:head> and <body> by <h:body>. You shouldn't add another ones, that would only result in invalid HTML.

    Particularly the <h:head> is mandatory as it allows component libraries like PrimeFaces to auto-include the necessary CSS/JS files by resource dependency injection. The <h:body> is only mandatory whenever you have <h:outputScript> elements with a target="body" so that they will be auto-relocated to the very bottom of the generated HTML <body> element.


    Update your concrete problem is caused by a conflict in the manually loaded jQuery library and the one which is auto-included by PrimeFaces. PrimeFaces uses jQuery and jQuery UI under the covers. If you stick to using PrimeFaces, I'd recommend to drop the manually loaded jQuery and use the PrimeFaces-bundled one instead. To cover pages where you don't use PrimeFaces components as well, you can explicitly load PrimeFaces-bundled jQuery for every page by adding the following line to the <h:head>:

    <h:outputScript library="primefaces" name="jquery/jquery.js" />
    
    0 讨论(0)
提交回复
热议问题