The moose likes JSF and the fly likes Efficient Script and Style Loading with RichFaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Efficient Script and Style Loading with RichFaces" Watch "Efficient Script and Style Loading with RichFaces" New topic

Efficient Script and Style Loading with RichFaces

Nick Dallamora

Joined: Aug 12, 2011
Posts: 1

Hi All!

I'm currently developing a web application that uses RichFaces 3.3.2. One of the benefits of this version of RichFaces is being able to control how it loads Scripts and Styling Sheets a la the LoadScriptStrategy and LoadStyleStrategy attributes you can set in web.xml. I currently have these values set to "DEFAULT" so that they are loaded on-demand and cached automatically after the cold call. This works well, but it also loads a lot of unnecessary junk into my application.

I'm wondering if there is a way to tell RichFaces to only import the packages that I'm using? Either that or some systematic approach to figuring out what files I DO need to import, that way I can set each of my strategies to "NONE" and do all of my importing manually.

Any advice/previous experience is greatly appreciated. Thanks guys.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Welcome to the JavaRanch, Nick!

You're using the terms "importing" and "packages" when asking about scripts and CSS. Those terms normally apply to Java classes.

What's more important for CSS and scripts is controlling client-side caching. RichFaces can easily dump down 100KB or more of JavaScript on a single page request, thereby slowing down page loads.

The primary options for scripts in RichFaces allow you to select which options you want to download under. You have your choice of one big clump of JavaScript where all the smaller scripts are wadded up into one big bundle or of keeping the smaller scripts separate and downloading each one individually. The One Big Script approach has the advantage that it only has to go through the overhead for script downloading once. However, depending on the structure of the app, you can end up consuming a lot of client-side resources to hold and process scripts that are rarely, if ever used.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Efficient Script and Style Loading with RichFaces
It's not a secret anymore!