This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Since I know about the existence of jQuery (about 3 years ago), many Java frameworks for web development have jQuery integrated in its implementation. Examples are Struts-jquery library, RichFaces and PrimeFaces, wich are Java web frameworks to work with server and client-side componentes to develop web apps.
There's an easy solution to workaround this kind of situation? Or it depends on the framework I use and how it was developed?
It's well known that I'm not a huge fan of most frameworks, and this is just one of the reasons.
That said, remember that in the end, all that ends up at the browser is an HTML page. So you can -- if you wish -- ignore the framework integration completely and just code to whatever HTML ends up at the browser. That means that you need to figure out whatever the framework is going to create as far as HTML is concerned from the server-side markup. That's perhaps just as much a pain.
Frameworks that are intensely invasive into the client-side markup tend to be my least favorite.
I was talking at how to, for example, ignore (or override) the jQuery library that comes with RichFaces (for example) with my own import of jQuery library on a simple manner. It's not a problem I'm facing with these days, but I'm afraid to face it with another frameworks I never worked with. I searched a little about jQuery.noConflict() and I think it could help me on this case, but I never used it.
The principle behind the noConflict function is to return the $ variable to its original value, i.e. prior to loading jQuery. This can be used with multiple versions of jQuery itself. The process would load the first version of jQuery and then any plugins that rely upon it. Next load the second version of jQuery and any plugins that require it. Then call noConflict to return $ to the first version and to assign a new variable to refer to the second version. Thereafter use the variables jQuery and the new one to refer to the different versions. Something like this: