Thymeleaf从入门到专家-第一篇简介

本文详细介绍了如何在SpringMVC框架中集成Thymeleaf模板引擎,实现对JSP的完全替代。内容涵盖使用SpringEL表达式、创建表单与Beans的绑定、国际化信息展示等方面,帮助开发者深入了解并掌握Thymeleaf的高级用法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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来管理国际\化文件显示国际化信息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值