2012-05-22 21 views
0

繼續使用帶有RichFaces組件的JQuery,我注意到當你導入一個JQuery腳本時,特別是這個:「http://ajax.googleapis.com /ajax/libs/jquery/1.3.2/jquery.min.js「,其中一個RichFaces組件,」rich:inplaceInput「似乎不起作用。輸入顯示,但它使用的JavaScript消失,所以無論您點擊多少次,都不會有任何反應。這裏是我的頭:RichFaces組件豐富:輸入似乎不能與JQuery一起工作

<f:view> 
     <html> 
     <head> 
       <meta http-equiv="X-UA-Compatible" content="IE=edge"/> 
       <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> 
       <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" /> 
       <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>    
       <link rel="stylesheet" type="text/css" href="../../css/custom-styles.css" /> 
       <script type="text/javascript" src="../../js/customJS.js"></script> 
       <a4j:loadScript src="resource:///jquery.js"/> 
     </head> 
     </html> 
    </f:view> 

和身體我創造出簡單且有我有一個簡單的面板和簡單的就地輸入:

 <rich:panel id="simplePanel" style="width:560px;height:100px;"> 
      <rich:inplaceInput id="sample" defaultLabel="Some text" /> 
     </rich:panel> 

這一切,和它的作品,只有當我刪除第一個腳本導入,其中包含「jquery.min」JavaScript文件。

任何想法爲什麼發生這種情況?這是RichFaces中的錯誤嗎?有沒有解決方法,或只有在升級RichFaces後纔有可能? (我正在使用3.3.3版本)

感謝您的幫助。

回答

1

我不熟悉,RichFaces的,但它似乎都與jQuery開箱

的,並且可以像這樣(參照版本,內置的jQuery它)

<a4j:loadScript 
src="resource:///org/richfaces/renderkit/html/scripts/jquery/jquery.js" /> 
使用

當您嘗試導入另一個jQuery.js文件時,它會導致衝突......

看吧Avoid jquery conflict in my jsf application

和這裏Richfaces with jQuery

瞭解更多...

相關問題