Closed edtha closed 3 years ago
You are right, in this case the server-side validation fails with a TemplateInputException
, which is caused by
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'form' available as request attribute
That's because, by default, the model attribute name is derived from the form class name, unless it is set explicitly using @ModelAttribute(…)
as you have done it. The other variant without an explicit @ModelAttribute
involves changing th:object
to use ${registrationForm}
instead of ${form}
in the <form>
in register.html
.
Why did you change
return "register";
to
return register(model, form);
? This shouldn't be necessary.
If you remove the required="required" attribute in the registration form and therefore disabling the front end check for empty strings an error occurs. Can anyone confirm this? My suggestion (which works for me) would be changing line 45 to 50 from being like
to being like
as it's being done in the guestbook form.