Working towards RichFaces/PrimeFaces compatibility

阅读更多

This article just a solution of conflict of jquery, not others, eg. skin issue and so on.

 

An article written by jboss richfaces developer illustrates richfaces resource mapping feature detailedly, before resolve the jQuery compaibility issue, you'd better read it.

Re-routing JSF resource requests with RichFaces Resource Mapping

 

In implentment jar of richfaces 4.3.4-Final(richfaces-components-ui-4.3.4.Final.jar/META-INF/resources/org.richfaces.staticResource/4.3.4.Final/Static/jquery.js) and Primefaces 4.0, you'll find that primefaces provided a jquery.js file, the file contains jquery 1.10.2 and some jquery ui script, meanwhile, richfacces provided a clean jquery file, but its version is 1.8.3. so two jquery files with different version conflicts each other.

 

After you read the article above, you've known, richfaces can re-routing resource with a little configuration, and a resource servlet to finish the work, and fortunately primefaces has no such resource resolver(after v2.x), I really love this non-invasive characteristic, so apparently, we must let richfaces use jquery file of primefaces, because the file contains jquery ui script, primefaces can't working without these ui script, let's start to config it.

 

Firstly, creat a directory/package named "META-INF" under your java source root directory, and create a directory named "richfaces" under "META-INF" directory, and then create a property file named "static-resource-mappings.properties" under "richfaces", typed following lines in it.

 

jquery.js=org.richfaces.staticResource/jquery.js
primefaces\:jquery/jquery.js=org.richfaces.staticResource/jquery.js

 

Secondly, create a directory in your webroot named "resources" and create a directory named "org.richfaces.staticResource" under it.

 

Finally,  copy jquery.js from primefaces jar file and put in directory named "org.richfaces.staticResource",

 

So your packaged directory structure should like following:
Working towards RichFaces/PrimeFaces compatibility_第1张图片
摘录

  • Working towards RichFaces/PrimeFaces compatibility_第2张图片
  • 大小: 18.9 KB
  • 查看图片附件

你可能感兴趣的:(Richfaces,Primefaces,jQuery)