my scenario:
- large amount of JSP (about 3000)
- not too much css files (about 100)
Today I have a lot of bundles that includes a couple of css files, as needed.
Then the jsp includes: or the bundles or the css files.
my scenario:
Today I have a lot of bundles that includes a couple of css files, as needed.
Then the jsp includes: or the bundles or the css files.
First of all, 100 css files is a very large number. It is important to reduce the number of http requests in order to improve performance. JAWR is a very good tool for this kind of scenarios. But you should be aware of the alternatives. One of them is called Web Resource Optimizer for Java or wro4j. It allows you to simplify the way you declare bundles (groups) or resources, for example:
<?xml version="1.0" encoding="UTF-8"?> <groups xmlns="http://www.isdc.ro/wro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.isdc.ro/wro wro.xsd"> <group name="all"> <css>/thirdparty/css/single.css</css> <css>/static/css/*.css</css> <css>http://www.mycompany.com/asset/main.css</css> <css>classpath:com/assets/from/classpath/app.css</css> </group> </groups>
This xml defines the way you group resources, it shows that you can include resources from inside the servlet context of you app, from external links or from inside jar archives (classpath). Also you can use wildcards to avoid including resources one by one.