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之间的区别
发布评论