Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a point about the need for the form-backing bean name to match the name given at the Spring side #56

Open
danielfernandez opened this issue Jan 13, 2018 · 0 comments

Comments

@danielfernandez
Copy link
Member

The name given to the form-backing bean variable used in <form th:object="${someBean} ...> should match the name assigned by Spring at the controller side, either because the name of the class matches:

@RequestMapping("/do")
public String something(final SomeBean form, final Errors errors) {
    ...
}

...or because a @ModelAttribute annotation has been added to force that name to be the one used:

@RequestMapping("/do")
public String something(@ModelAttribute("someBean") final Form form, final Errors errors) {
    ...
}

Failing to do so will result in Thymeleaf being unable to detect bean validation errors at the view side. See thymeleaf/thymeleaf-spring#169.

However, this is not mentioned in the documentation (though it is done at the STSM example application). We should mention it explicitly somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant