How does BindingResult.rejectValue(...) work with Object[] errorArgs?

50 Views Asked by At

How can I solve this method with the Object[] errorArgs parameter?

Working option Spring Controller:

bindingResult.rejectValue("password","error.password", "123");
            bindingResult.rejectValue("password","error.password", "345");
            bindingResult.rejectValue("password","error.password", "678");
            bindingResult.rejectValue("password","error.password", "910");

Thymeleaf:

 <div class="alert alert-danger" th:if="${#fields.hasErrors('password')}">
                        <div th:each="err : ${#fields.errors('password')}">
                            <li class="small" th:text="${err}"></li>
                        </div>
                    </div>

What would I like:

bindingResult.rejectValue("password","error.password", new String[] {"123", "345", "678", "910"}, "");

with the same Thymeleaf.

0

There are 0 best solutions below