Spring JSP MVC和Thymeleaf MVC之间的区别

编程入门 行业动态 更新时间:2024-10-23 11:23:48
本文介绍了Spring JSP MVC和Thymeleaf MVC之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

spring JSP MVC和Thymeleaf MVC有什么区别?哪一种是春季网页设计的最佳方法?

What is the difference between spring JSP MVC and Thymeleaf MVC? Which one is best way for spring web design ?

推荐答案

它们都是Spring MVC的视图层.首先,最基本的区别是文件扩展名. (.jsp& .html)

Both of them are view layers of Spring MVC. Firstly, the very basic difference is the file extensions. (.jsp & .html)

Branislav是正确的,JSP不是模板引擎.它被编译为servlet,然后servlet正在提供Web内容.另一方面,Thymeleaf是一个模板引擎,它提取HTML文件,对其进行解析,然后生成要提供的Web内容.

Branislav in the comments is right, JSP is not a template engine. It's compiled to the servlet and then the servlet is serving web content. On the other hand, Thymeleaf is a template engine which takes the HTML file, parses it and then produces web content which is being served.

  • Thymeleaf与JSP视图进行比较时,它更像是HTML样式的视图.

  • Thymeleaf is more like an HTML-ish view when you compare it with JSP views.

我们可以在thymeleaf中使用原型代码: www.dineshonjava/2015/01/thymeleaf-vs-jsp-spring-mvc-view-layer.html#.WEkLzLKLTig

We can use prototype code in thymeleaf : www.dineshonjava/2015/01/thymeleaf-vs-jsp-spring-mvc-view-layer.html#.WEkLzLKLTig

由于它是HTML风格的代码,因此百里香叶代码更具可读性(当然,您可以将其打乱并创建不可读的代码,但是最后,与.jsp进行比较时,它将更具可读性文件)

Since it is more HTML-ish code, thymeleaf codes are more readable (of course you can disrupt it and create unreadable codes, but at the end, it will be more readable when you compare it with .jsp files)

标准方言(表达式语言)比JSP表达式语言

Standard Dialect (The expression language) is much more powerful than JSP Expression Language

如果我们把所有这些都放在边缘,那么百里香是最慢的一种.

If we put all this to an edge, thymeleaf is the slow one here.

我建议您看看以下文档: www. thymeleaf/doc/articles/thvsjsp.html

I would suggest you to take a look at this doc : www.thymeleaf/doc/articles/thvsjsp.html

更多推荐

Spring JSP MVC和Thymeleaf MVC之间的区别

本文发布于:2023-11-24 21:12:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626849.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:区别   JSP   Spring   Thymeleaf   MVC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!