Thymeleaf cannot parse URL query parameters
P粉619896145
2023-08-14 15:57:04
<p>I'm using Thymeleaf version 2.1.4 and I want to print a string when sending query parameters to the URL. But it prints a string object, like this <code>[Ljava.lang.String;@767a8ed5</code>. I try to print it like this in HTML: </p>
<pre class="brush:php;toolbar:false;"><p th:text="${param.message}"></p></pre>
<p>The URL is like this: </p>
<pre class="brush:php;toolbar:false;">http://localhost:8000/about?message=This is about page.</pre>
<p>Appreciate the error in my code and hope for help. </p>
The Param object returns an array of strings for each parameter, even if the parameter has only one value, which is why you see the object reference
[Ljava.lang.String;@767a8ed5
. You can access the first element of the array using indexing like this: