Hi Kenny,

The idea behind keeping the templates in the classpath, rather than somewhere else, is that this apporach allows you to package the entire component into a JAR file (as well as any related files if you access them as assets).

For example, in our company we have built a number of Tapestry component libraries that we use in various projects. The components are included into the projects as JAR files, and when we update them (bug fixes, new features, etc), all we need to do is replace the JAR files in all of the projects that use them. This is a quick, easy, and safe. It would not have been possible to do it so easily if the templates were stored, for example, in the servet container's context path (where the static html files reside), instead.

In any case, if you still want to get the templates from somewhere else, you can override the method 'createTemplateSource()' in your Engine and return your own implementation of the ITemplateSource interface. That will allow you to define your own logic for locating the templates of the components (you can even get them from a database if you wish to).

You can find the default implementation of ITemplateSource in net.sf.tapestry.engine.DefaultTemplateSource. Please keep in mind that if you care about preserving the template localization mechanism, you should get templates depending on the supplied locale (e.g. Template_en_US.html, if present; then Template_en.html, etc).

I hope this helps,

- mb

 



Do You Yahoo!?
New! SBC Yahoo! Dial - 1st Month Free & unlimited access

Reply via email to