to show a error text message above form if this username/password does not exist in the database. (Its not field validation!).
Now I'm using model.addAttribute to pass a string message to the view and return view page name in controller class.
But this causes form page refresh again.
I dont want fully refresh and dont want use ajax and want update message only.
Can I use global errors in this case?
I think the BindingResults class is your friend. Please check out these posts: 1. https://www.javaguides.net/2018/10/spring-boot-spring-mvc-validating-form.html 2. https://www.javaguides.net/2018/09/spring-boot-spring-mvc-role-based-spring-security-jpa-thymeleaf-mysql-tutorial.html 3. https://spring.io/guides/gs/validating-form-input/
Обсуждают сегодня