Thymeleaf从入门到专家
官方文档:
https://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.html#creating-a-form
1、简介
Thymeleaf offers a set of Spring integrations that allow you to use it as a fully-featured substitute for JSP in Spring MVC applications.
These integrations will allow you to:
- Make the mapped methods in your Spring MVC @Controller objects forward to templates managed by Thymeleaf, exactly like you do with JSPs.
- Use Spring Expression Language (Spring EL) instead of OGNL in your templates.
- Create forms in your templates that are completely integrated with your form-backing beans and result bindings, including the use of property editors, conversion services and validation error handling.
- Display internationalization messages from message files managed by Spring (through the usual MessageSource objects).
- Resolve your templates using Spring’s own resource resolution mechanisms.
Note that in order to fully understand this tutorial, you should have first gone through the “Using Thymeleaf”tutorial, which explains the Standard Dialect in depth.
Thymeleaf 提供了一套spring的集成方案,允许你在spring应用中使用Thymeleaf完全替代JSP。
这个集成方案允许
- 就像控制JSP一样,使用SpringMvc的@Controller注解来映射Thymeleaf的模板文件。
- 在模板中使用SpringEL表达式来替换OGNL
- 在模板中创建的表单,完全支持Beans和结果的绑定,包括使用PropertyEditor,转换,和验证等。
- 可以通过Spring来管理国际\化文件显示国际化信息。