• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Efficient Script and Style Loading with RichFaces

 
Nick Dallamora
Greenhorn
Posts: 1
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

-Nick
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic