Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thymeleaf Get Curent request parameter

I am developing a web app with Thymeleaf and Spring boot. I am using Fragments and a layout ; All I need is to print the request parameter in the header.

Exemple :

  • when i open localhost:8080/foo/boo , My header print /foo/boo
  • when i open localhost:8080/foo?size=5 , My header print /foo?size=5

Is there any variable in Thymeleaf to get that ?

Thank you

like image 707
NeptuneZ Avatar asked Dec 18 '22 05:12

NeptuneZ


1 Answers

The path up to the query string:

${#request.requestURI}

The query string:

${#request.queryString}

Get a specific parameter (from the query string):

${#request.getParameter('size')}
like image 125
holmis83 Avatar answered Jan 08 '23 05:01

holmis83