Thymeleaf dialect
AcrossWebModule also registers a custom Thymeleaf dialect. The Thymeleaf dialect uses the prefix across and offers a number of utility elements, attributes and expression objects.
Element processors
The AcrossWebDialect
adds the following elements that can be used in HTML templates:
Name | Description | Attributes |
---|---|---|
across:view |
Takes a |
element : |
Attribute processors
The AcrossWebDialect
adds the following attributes that can be used in HTML templates:
Name | Description | Examples |
---|---|---|
across:resource |
Takes a relative path to a static resource. Will generate a valid url path to that static resource and will write the value as a new attribute. The name of the attribute that will be written depends on the element the attribute is used on. All HTML5 elements supporting src or href attributes are supported, along with image and use elements |
<a across:resource="/img"/> <script across:resource="/js/my.js"/> <image across:resource="/img"/> |
across:static |
Takes a relative path to a resource in the static subfolder. Using across:static="/img" would be the same as using across:resource="/static/img". Supports the same elements as across:resource. |
<a across:static="/img"/> |
across:resource-attr-name |
Same as across:resource except the resulting attribute name will be attr-name. |
<a across:resource-data-url="/img"/> |
across:static-attr-name |
Same as across:static except the resulting attribute name will be attr-name. |
<a across:static-data-url="/img"/> |
Expression objects
The AcrossWebDialect
makes the following expression objects available for script execution:
Name | Value | Description |
---|---|---|
#webapp |
|
Used for generating prefixed links based on a relative path. For example to static resources. These links can still be processed by the Thymeleaf link builder ( |
#htmlIdStore |
|
Holds the generated HTML id attribute for a |
URL support
Apart from the availability of #webapp, AcrossWebModule activates transparent support for the WebAppPathResolver
on Thymeleaf URL generation.
Example: <img th:src="@{@static:/img}"> would produce <img src="/res/static/img">