Configuring resource handlers
Starting with JSF 2.0, all the web resources, such as CSS, JavaScript, and images are loaded from a folder named resources
, present under the root of your web application or from /META-INF/resources
in JAR files. A folder under the resources
folder is known as a library
or theme
, which is like a collection of client artifacts. We can also create a special folder matching the regex \d+(_\d+)*
under the library
folder for providing versioning. In this case, the default JSF resource handler will always retrieve the newest version to display. The various approaches that can be followed for structuring the resources
folder are as shown in the following figure:
In the preceding figure, part A depicts a common structure of the resources
folder without versioning, and in part B, you have the versioning approach. The folders css
, js
, img
, and others usually denote the content type of files inside them; however, this is not mandatory.
Note
Note that the library name shouldn...