Search code examples
jqueryjsfrichfacesprototypejs

Which RichFaces components use prototype, which use jquery?


I am trying to remove jquery and prototype and Scriptaculous from my RichFaces project. I dont want those libs in there because i want to use the latest version of jQuery in this project, and having 3 old versions of these libs makes it difficult.

I cant find any docs online that say which parts of RichFaces require these libs. In fact, it seems kind of crazy to me that they decided to include both prototype and jquery in there.


Solution

  • If you are using RichFaces 3.1.x you can add this in your web.xml file

    <context-param>
       <param-name>org.richfaces.ExcludeScripts</param-name>
       <param-value>Prototype,Scriptaculous,JQuery</param-value>
    </context-param>
    

    However, this will not work in later versions. More information here.

    If you want to use the latest jQuery in your own code, have a look at this blog post I wrote explaining how you can use your own jQuery version without conflicts.

    The basic idea is that you have to use jQuery.noConflict(); You can assign this to your own selector ie: $j = jQuery.noConflict();

    Then you are free to use your own jQuery version without affecting the version shipped with Richfaces.

    function showMessages() {
      $j("div#messagetextPanel").fadeIn("fast");
    }
    

    Richfaces 4.x is bundled with jQuery 1.4