I have the following code setting a variable in my controller:
model.set(\"type\", type);
In the thymeleaf view I want to construct a form
You need concatenate string inside @{}.
@{} is used for URL rewriting. Part of URL rewriting is keeping track of session. First time user request URL, app server adds to url ;jsessionid=somehexvalue and generates cookie with jsessionid. When client sends cookie during next request server knows client supports cookies. If server knows that client support cookies, server will not keep addind jsessionid in URL.
My preferred way is literal substitution with the pipeline syntax (|).
Thymeleaf path variable syntax is
Reference: Thymeleaf Standard URL Syntax