2014-10-09 108 views
0

我試圖使用從編輯primefaces:Primefaces編輯和JQuery

<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:f="http://java.sun.com/jsf/core" 
     xmlns:p="http://primefaces.org/ui"> 
<h:head> 
    <title> 

    </title> 
</h:head> 

<h:body> 
    <p:editor/> 
</h:body> 
</html> 

現在所有工作正常,但如果我添加jQuery庫,然後我得到錯誤:

screen

+1

如何添加jQuery庫? Primefaces會在您使用其組件時自動添加jQuery,因此您不需要手動添加它。 – mrganser 2014-10-09 12:33:50

+0

謝謝。但是,如果我在所有頁面的頁眉上都有JQuery導入,並且只在某些頁面中有primefaces元素。 – user2783755 2014-10-09 13:25:59

+1

您是否嘗試使用Primefaces?:'' – mrganser 2014-10-09 13:36:39

回答

1

Primefaces有一個綁定的jQuery,當你使用它的組件時,它會包含它。爲避免衝突,您應該始終包含與Primefaces捆綁在一起的版本,以便您還可以在沒有Primefaces組件的頁面中使用它:

<h:outputScript library="primefaces" name="jquery/jquery.js" />