如何将所有百里香输入字段转换为UpperCase?

问题描述

<input class="form-control"
           type="text"
           th:value="${dto.field}" name="field" />

是否可以将输入值直接转换为大写? 就像伪代码一样:

th:value="${#StringUtils.toupperCase(dto.field)}"

解决方法

您可以使用#strings实用程序对象从StringUtils类访问方法。

在您的情况下:

th:value="${#strings.toUpperCase(dto.field)}"