Class RequestDataValues
- Object
-
- org.thymeleaf.spring3.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
andth:field
. But sometimes there is a need to manually apply these behaviours when e.g. creating and using URLs outside attributes such asth:href
orth: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.0
- Author:
- Daniel Fernández
-
-
Constructor Summary
Constructors Constructor Description RequestDataValues(org.thymeleaf.context.ITemplateContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
action(String action, String httpMethod)
Map<String,String>
extraHiddenFields()
String
formFieldValue(String name, String value, String type)
String
url(String url)
-