thymeleaf-extras-terasoluna-gfw

Logo

Thymeleaf Dialect for Terasoluna Server Framework 5.x

View the Project on GitHub yoshikawaa/thymeleaf-extras-terasoluna-gfw

Thymeleaf custom dialect based on TERASOLUNA Framework 5.x JSP tag library.

This is a personal experimental project unrelated to TERASOLUNA. TERASOLUNA is a registered trademark of NTT DATA Corporation.

Notes


Getting Start

Configure dependency.

<dependency>
    <groupId>io.github.yoshikawaa.gfw</groupId>
    <artifactId>thymeleaf-extras-terasoluna-gfw</artifactId>
    <version>1.1.0</version>
</dependency>

Configure SpringTemplateEngine.

Add dialect TerasolunaGfwDialect to SpringTemplateEngine.

Configure template HTMLs.

Add xml name space to template HTMLs.

<!DOCTYPE html>
<html xmlns:t="https://io.github.yoshikawaa">
    <!-- omitted. -->
</html>

By Default, name space is t. If you change name space, set dialectPrefix to TerasolunaGfwDialect.


Features

t:messages-panel

Output messages as children elements.

<div t:messages-panel>messages</div>

By default, the attribute named resultMessages is searched in order of request, session, and servlet context and outputted.

Supports messages of the following types.

Supports a message of the following types.

You can customize with the following attribute values.

name description default
messages-panel source of the messages as expression ex. ${messages}. ``
panel-class-name 1st css class name to add. alart
panel-type-class-prefix 2nd css class name prefix to add. alart-
messages-type 2nd css class name suffix to add. (If use ResultMessages, automatically set) ``
outer-element tag name of list. ul
inner-element tag name of list element. li

t:pagination

Output Page object as pagination links.

<ul t:pagination>page links</ul>

By default, the expression ${page} is interpreted and outputted.

You can customize with the following attribute values.

name description default
pagination source of the page as expression ex. ${cotents}. ${page}
inner-element tag name of page link element. li
disabled-class class name of link inactive. disabled
active-class class name of link active. active
first-link-text caption of link to first page. <<
previous-link-text caption of link to previous page. <
next-link-text caption of link to next page. >
last-link-text caption of link to last page. >>
max-display-count count of display page number links. 5
disabled-href URL of link inactive. javascript:void(0)
href-tmpl URL template as @{/}. If want to build query string from Objects, Maps, can use #query.urlexpression(). ``
enable-link-of-current-page enable to link to current page or not. false

t:transaction

Output transaction token to hidden input field named _TRANSACTION_TOKEN without th:action.

<input t:transaction />

By default, the attribute named org.terasoluna.gfw.web.token.transaction.TransactionTokenInterceptor.NEXT_TOKEN is searched in order of request, session, and servlet context and outputted.

If you use th:action, TransactionTokenRequestDataValueProcessor automatically output the hidden fields as well.

You can customize with the following attribute values.

name description default
transaction source of the token as expression ex. ${token}. ``

t:mtext

Escape text and convert line-break characters to <br> element.

<span t:mtext="${text}">multi-line text</span>

Support CR, LF, and CRLF as line-break characters.

#query

Build Query String same as Functions#query().

<a th:href="http://example.com/sample?${#query.string(form)}">

#query.string() is provided for building direct URI. This builds query string with URI encode using #uris.escapeQueryParam().

<ul t:pagination t:href-tmpl="@{/sample(__${#query.urlexpression(form)}__)}">page links</ul>

#query.urlexpression() is provided for using into URL Expression @{}. This builds query string without URI encode.