Class RequestDataValues

Object
org.thymeleaf.spring6.expression.RequestDataValues

public class RequestDataValues extends Object

Expression object that offers the functionality of Spring MVC's RequestDataValueProcessor for performing last-moment modifications to request data values such as URLs or form contents in order to enable mechanism such as CSRF protection.

Methods in this class correspond to the methods in Spring MVC's org.springframework.web.servlet.support.RequestDataValueProcessor.

Using this expression object is not needed in most scenarios, as its functionality will be automatically applied by th:href, th:src, th:action, th:value, th:method and th:field. But sometimes there is a need to manually apply these behaviours when e.g. creating and using URLs outside attributes such as th:href or th:src.

An example of such scenario would be using an URL as a parameter in a message expression:

msg.knowmore=Click <a href="{0}">here</a> if you want to know more.

And then in template code:

<p th:with="morelink=@{/detail/more}" th:utext="#{msg.knowmore(${#requestdatavalues.url(morelink)})}">
Since:
3.0.3
Author:
Daniel Fernández