Template Resolution

Where should templates be placed in the web application? By convention, Jetspeed looks for JSP Portlet templates in the Jetspeed deployment under /WEB-INF/templates/jsp/portlets/html (for HTML portlets). Similarly, WML portlets would be found under /WEB-INF/templates/jsp/portlets/wml. The resolution of portlet templates is based on several configuration files and a resolution algorithm.

The TurbineResources.properties is where the first part of the configuration goes:


services.JspService.templates = /WEB-INF/templates/jsp, /WEB-INF/mytemplates/jsp

You can specify multiple paths by comma-separating the paths. Secondly, the JetspeedResources.properties must be updated with the same path, but to root directory containing all templates (both JSP and VM).The list may also be comma-separated.


services.TemplateLocator.templateRoot=/WEB-INF/templates,/WEB-INF/mytemplates

The template resolution algorithm finds the template. The resolver is a service and is pluggable. The default service has a resolution algorithm much like how the Profiler service resolves PSML resources.

Templates resources may be optionally localised. Templates are localized by placing them in sub-directories based on language and country code abbreviations. The language-code sub-directory contains one or more country-code subdirectories.

The language-code directory name is specified with an ISO-639 standard two-character language abbreviation. The country-code subdirectory is optional, and is specified with an IS0-3166 standard two-character country code abbreviation.

An example:


  jsp
   |-- portlets
        |-- html
             |-- fr                          // french language
                  |-- FR                     // France country-code
                  |-- BE                     // Belgium country-code

NOTE: The country codes must be in upper-case

For a given locale of fr_FR, and an HTML request, the search order for a template named grenouille.jsp would be:


jsp/portlets/html/fr/FR/grenouille.jsp   
jsp/portlets/html/fr/grenouille.jsp
jsp/portlets/html/grenouille.jsp
jsp/portlets/grenouille.jsp

The template locator looks at the "Content Language" HTML header for locale specific settings. If there are multiple settings, all settings will be searched until the first resource is found. (This is currently not supported)

For a complete list of ISO-639 standard language abbreviations, see:

http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt

For a complete list of ISO-3166 standard country code abbreviations, see:

http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html