Search code examples
spring-bootthymeleaf

What class should be used for param thymesVar


In IntelliJ I'm using the thymesVar comment to resolve variables used in Thymeleaf expressions.

I'm wondering what should be in there to resolve the param variable.

For example, when I have this in the Thymeleaf template:

 <div th:if="${param.error}" class="alert alert-danger">
     <p>Invalid username and password.</p>
 </div>

Then what should be the type

 <!--/*@thymesVar id="loginCommand" type="something.to.resolve.param"*/-->

Solution

  • The answer is a little late and you've probably learned it by now. But for other readers, param.error is a String array. So type="java.lang.String[]".

    You can double check this by using th:text=${param.error.class.name}.