If you require jQuery in a Java SEAM project (or a web application using JSF or Struts but embedding Richfaces in it),
you’ll need to redefine jQuery’s $() shortcut to avoid conflict with prototype.js which is widely used in Richfaces framework
Luckily you can use a4j’s loadScript function since as of Richfaces 3.0, jQuery has this builtin.
To use the jQuery that is bundled in RichFaces, you have to load the correct script.
<a4j:loadScript src="resource://jquery.js"/>
To resolve such cases jQuery introduces the .noConflict() function.
Now you can assign jQuery to $j for convenience. Add the following in your javascript code:
$j = jQuery.noConflict();
Then you have to replace all your former $() with $j() or the equivalents $. $[] and function($) with $j. $j[] and function($j)
Published by anthonykuong
Anthony is a versatile Software professional with around 10 years of experience. He is a Full Stack developer experienced with clients in the Financial, Health and Supply Chain industries. He is experienced with MVC frameworks ( Spring Boot) , SPA frameworks ( Angular , VueJS), and also supports automated build deployments and packaging for development, qa, and production servers.. He has delivered rich user experience using
Modern web technologies and techniques such are HTML5, CSS3, ECMAScript 6 (ES6)/ ECMAScript 2015, CSS pre-processors (SASS, Less), JavaScript build tools (Grunt, Gulp) , various UI Frameworks including AngularJS , Knockout JS , and CSS Frameworks including Bootstrap, and Foundation. He is adaptable to new technologies and frameworks. He is a rigorous, quality-conscious contributor with solid analytical skills.
I can also be found on youtube - Youtube Channel: https://www.youtube.com/user/akuong/
View more posts