I'm far from being the expert but classpath assets really come into play once you start building components and libraries. In that case, you can just drop the library/component jar into your classpath and your component will work as expected. In contrast, if you try to use context assets for a component, after you deploy the library jar, you'd have to separately copy all assets (images, js, whatever) into the webapp where you added the library - clearly not something you want.
When you're working with context assets, it is my understanding that it is recommended that you use the <script src="${context:js/foo.js}" type="text/javascript" >expansions, instead of just referencing the javascript old school. If you do so, you will get all benefits from the js being an asset (e.g. you can have internationalized js that's included based on the user's locale - e.g. a user from bulgaria will get a foo_bg.js, a user from france will get a foo_fr.js) Hope this helps, Alex Kotchnev On Tue, Feb 24, 2009 at 4:44 PM, Jason Tan <jtan...@gmail.com> wrote: > I'm having trouble understanding the difference between classpath vs. > context assets -- when is it better to use one or the other? Right now I've > been putting Javascript and CSS under src/main/webapp/ , and referencing it > old-school using <script src="foo.js" type="text/javascript" ></script> but > am learning about the new @IncludeJavaScriptLibrary annotation. It appears > to use classpath assets though, and if I understand it correctly, expects > files to be in src/main/resources. Another advantage of classpath assets > appears to be versioning for cache-busting (although it looks like 5.1 will > include this for context assets too?). Should I be putting my JS/CSS/static > images in src/main/resources, packaged with .tml files? > > Anyway, any sort of clarification would be appreciated. > > Thanks, > Jason >