|Home > Guides > Tag Developers Guide > Struts Tags > Tag Reference > UI Tag Reference > dojo head|
<sx:head debug="true" cache="false" compressed="false" />
Dojo files are loaded as required by the Dojo loading mechanism. The problem with this approach is that the files are not cached by the browser, so reloading a page or navigating to a different page that uses the same widgets will cause the files to be reloaded. To solve this problem a custom Dojo profile is distributed with the Dojo plugin. This profile contains the files required by the tags in the Dojo plugin, all in one file (524Kb), which is cached by the browser. This file will take longer to load by the browser but it will be downloaded only once. By default the "cache" attribute is set to false.
Some tags like the "datetimepicker" can use different locales, to use a locale that is different from the request locale, it must be specified on the "extraLocales" attribute. This attribute can contain a comma separated list of locale names. From Dojo's documentation:
The locale is a short string, defined by the host environment, which conforms to RFC 3066 (http://www.ietf.org/rfc/rfc3066.txt) used in the HTML specification. It consists of short identifiers, typically two characters long which are case-insensitive. Note that Dojo uses dash separators, not underscores like Java (e.g. "en-us", not "en_US"). Typically country codes are used in the optional second identifier, and additional variants may be specified. For example, Japanese is "ja"; Japanese in Japan is "ja-jp". Notice that the lower case is intentional – while Dojo will often convert all locales to lowercase to normalize them, it is the lowercase that must be used when defining your resources.
The "locale" attribute configures Dojo's locale:
"The locale Dojo uses on a page may be overridden by setting djConfig.locale. This may be done to accomodate applications with a known user profile or server pages which do manual assembly and assume a certain locale. You may also set djConfig.extraLocale to load localizations in addition to your own, in case you want to specify a particular translation or have multiple languages appear on your page."
To improve loading time, the property "parseContent" is set to false by default. This property will instruct Dojo to only build widgets using specific element ids. If the property is set to true Dojo will scan the whole document looking for widgets.
Dojo 0.4.3 is distributed with the Dojo plugin, to use a different Dojo version, the "baseRelativePath" attribute can be set to the URL of the Dojo root folder on your application.
Dynamic Attributes Allowed:false
|baseRelativePath||false||/struts/dojo||false||String||Context relative path of Dojo distribution folder|
|cache||false||true||false||Boolean||Use Struts Dojo profile, which contains all Struts widgets in one file, making it possible to be chached by the browser|
|compressed||false||true||false||Boolean||Use compressed version of dojo.js|
|debug||false||false||false||Boolean||Enable Dojo debug messages|
|extraLocales||false||false||String||Comma separated list of locale names to be loaded by Dojo, locale names must be specified as in RFC3066|
|locale||false||false||String||Default locale to be used by Dojo, locale name must be specified as in RFC3066|
|parseContent||false||false||false||Boolean||Parse the whole document for widgets|