Spring、Struts、Hibernate、JavaServer Faces、Tapestry 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2841212/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 13:30:44  来源:igfitidea点击:

What is the difference between Spring, Struts, Hibernate, JavaServer Faces, Tapestry?

javaframeworksjakarta-ee

提问by CMW

May I know what is the difference between:-

我可以知道有什么区别: -

  1. Spring
  2. Struts
  3. Struts 2
  4. Hibernate
  5. JavaServer Faces
  6. JavaServer Pages
  7. Tapestry
  1. 春天
  2. 支柱
  3. 支柱 2
  4. 休眠
  5. JavaServer Faces
  6. JavaServer 页面
  7. 挂毯

Are these technologies/framework complementary to each other? Or they are alternatives to each other (after I use one of them, then I don't need to use the other)?

这些技术/框架是否相互补充?或者它们是彼此的替代品(在我使用其中一个之后,我就不需要使用另一个了)?

Thanks.

谢谢。

采纳答案by Pascal Thivent

  1. Spring is an IoC container(at least the core of Spring) and is used to wire things using dependency injection. Spring provides additional services like transaction management and seamless integration of various other technologies.
  2. Struts is an action-based presentation framework(but don't use it for a new development).
  3. Struts 2 is an action-based presentation framework, the version 2 of the above (created from a merge of WebWork with Struts).
  4. Hibernate is an object-relational mapping tool, a persistence framework.
  5. JavaServer Faces is component-based presentation framework.
  6. JavaServer Pages is a view technology used by all mentioned presentation framework for the view.
  7. Tapestry is another component-based presentation framework.
  1. Spring 是一个IoC 容器(至少是 Spring 的核心),用于使用依赖注入来连接事物。Spring 提供额外的服务,如事务管理和各种其他技术的无缝集成。
  2. Struts 是一个基于动作的表示框架(但不要将它用于新的开发)。
  3. Struts 2 是一个基于动作的表示框架,是上述框架的第 2 版(由 WebWork 与 Struts 合并创建)。
  4. Hibernate 是一个对象关系映射工具,一个持久化框架
  5. JavaServer Faces 是基于组件的表示框架
  6. JavaServer Pages 是所有提到的视图表示框架都使用的视图技术。
  7. Tapestry 是另一个基于组件的表示框架

So, to summarize:

所以,总结一下:

  • Struts 2, JSF, Tapestry (and Wicket, Spring MVC, Stripes) are presentation frameworks. If you use one of them, you don't use another.
  • Hibernate is a persistence frameworkand is used to persist Java objects in a relational database.
  • Spring can be used to wire all this together and to provide declarative transaction management.
  • Struts 2、JSF、Tapestry(和 Wicket、Spring MVC、Stripes)是表示框架。如果您使用其中之一,则不会使用另一个。
  • Hibernate 是一个持久性框架,用于在关系数据库中持久化 Java 对象。
  • Spring 可用于将所有这些连接在一起并提供声明式事务管理。

I don't want to make things more confusing but note that Java EE 6 provides modern, standardized and very nice equivalent of the above frameworks: JSF 2.0 and Facelets for the presentation, JPA 2.0 for the persistence, Dependency Injection, etc. For a new development, this is IMO a seriousoption, Java EE 6 is a greatstack.

我不想让事情变得更混乱,但请注意,Java EE 6 提供了现代、标准化和非常好的上述框架的等价物:用于表示的 JSF 2.0 和 Facelets,用于持久性的 JPA 2.0,依赖注入等。对于一个新开发,这是 IMO 一个严肃的选择,Java EE 6 是一个很棒的堆栈。

See also

也可以看看

回答by Srikar Doddi

You can see the overview and ranking for yourself here. Hibernate is an ORM, so you can use either struts+Hiberante or spring+hibernate to build a web app. Different web frameworks and many are alternatives to each other.

您可以在此处查看自己的概览和排名。Hibernate 是一个 ORM,因此您可以使用 struts+Hiberante 或 spring+hibernate 来构建 Web 应用程序。不同的 web 框架和许多是彼此的替代品。

回答by dipak

In hibernate you need not bother about how to create table in SQL and you need not to remember connection ,prepared statement like that data is persisted in a database. So, basically it makes a developer's life easy.

在休眠中,您无需担心如何在 SQL 中创建表,也无需记住连接、准备好的语句,例如将数据保存在数据库中。因此,基本上它使开发人员的生活变得轻松。

回答by Pradip Bhatt

Generally...

一般来说...

Hibernate is used for handling database operations. There is a rich set of database utility functionality, which reduces your number of lines of code. Especially you have to read @Annotation of hibernate. It is an ORM framework and persistence layer.

Hibernate 用于处理数据库操作。有一组丰富的数据库实用程序功能,可减少您的代码行数。特别是你必须阅读 hibernate 的@Annotation。它是一个 ORM 框架和持久层。

Spring provides a rich set of the Injection based working mechanism. Currently, Spring is well-known. You have to also read about Spring AOP. There is a bridge between Struts and Hibernate. Mainly Spring provides this kind of utility.

Spring 提供了一套丰富的基于注入的工作机制。目前,Spring是众所周知的。您还必须阅读有关 Spring AOP 的内容。Struts 和 Hibernate 之间有一座桥梁。主要是 Spring 提供了这种实用程序。

Struts2 provides action based programming. There are a rich set of Struts tags. Struts prove action based programming so you have to maintain all the relevant control of your view.

Struts2 提供基于动作的编程。有一组丰富的 Struts 标签。Struts 证明了基于动作的编程,因此您必须保持对视图的所有相关控制。

In Addition, Tapestry is a different framework for Java. In which you have to handle only .tml(template file). You have to create two main files for any class. One is JAVA class and another one is its template. Both names are same. Tapestry automatically calls related classes.

此外,Tapestry 是一个不同的 Java 框架。您只需要在其中处理.tml(模板文件)。您必须为任何类创建两个主要文件。一个是JAVA类,另一个是它的模板。两个名字都一样。Tapestry 自动调用相关类。

回答by Nishat Lakhani

Spring is an application framework which deals with IOC (Inversion of Control).

Spring 是一个处理 IOC(控制反转)的应用程序框架。

Struts 2 is a web application MVC framework which deals with actions.

Struts 2 是一个处理动作的 Web 应用程序 MVC 框架。

Hibernate is an ORM (Object-Relational Mapping) that deals with persistent data.

Hibernate 是一种处理持久数据的 ORM(对象关系映射)。

回答by Nishat Lakhani

Tapestrypages and components are simple POJO's(Plain Old Java Object)consisting of getters and setters for easy access to Java language features.

Tapestry页面和组件是简单的POJO(Plain Old Java Object),由 getter 和 setter 组成,可以轻松访问 Java 语言功能。

回答by Raman Gupta

Difference between Spring, Strutsand Hibernateare following:

SpringStrutsHibernate之间的区别如下:

  1. Spring is an Application Frameworkbut Struts and hibernate is not.
  2. Spring and Hibernate are Light weightedbut Struts 2 is not.
  3. Spring and Hibernate has layered architecturebut Struts 2 doesn't.
  4. Spring and Hibernate support loose couplingbut Struts 2 doesn't.
  5. Struts 2 and Hibernate have tag librarybut Spring doesn't.
  6. Spring and Hibernate have easy integration with ORM technologiesbut Struts doesn't.
  7. Struts 2 has easy integration with client-side technologiesbut Spring and Hibernate don't have.
  1. Spring 是一个应用程序框架,但 Struts 和 hibernate 不是。
  2. Spring 和 Hibernate 是轻量级的,但 Struts 2 不是。
  3. Spring 和 Hibernate 具有分层架构,但 Struts 2 没有。
  4. Spring 和 Hibernate 支持松散耦合,但 Struts 2 不支持
  5. Struts 2 和 Hibernate 有标签库,但 Spring 没有。
  6. Spring 和 Hibernate 可以轻松地与 ORM 技术集成,但 Struts 没有。
  7. Struts 2 可以轻松地与客户端技术集成,但 Spring 和 Hibernate 没有。

回答by Tushar Jumani

In short,

简而言之,

Strutsis for Front-end development of website

Struts用于网站前端开发

Hibernateis for back-end development of website

Hibernate用于网站的后端开发

Springis for full stack development of website in which Spring MVC(Model-View-Controller) is for Front-end. ORM, JDBC for Data Access / Integration(backend). etc

Spring用于网站的全栈开发,其中 Spring MVC(模型-视图-控制器)用于前端。ORM、JDBC 用于数据访问/集成(后端)。等等

回答by VyTcdc

Springis a light weight and open source framework created by Rod Johnsonin 2003. Spring is a complete and a modular framework, Spring framework can be used for all layer implementations for a real time application or spring can be used for the development of particular layer of a real time application.

SpringRod Johnson于 2003 年创建的轻量级开源框架。Spring是一个完整的模块化框架,Spring 框架可用于实时应用程序的所有层实现,也可用于特定层的开发一个实时应用程序。

Strutsis an open-source web application framework for developing Java EE web applications. It uses and extends the Java Servlet API to encourage developers to adopt a model–view–controller (MVC) architecture. It was originally created by Craig McClanahanand donated to the Apache Foundation in May, 2000.

Struts是用于开发 Java EE Web 应用程序的开源 Web 应用程序框架。它使用并扩展了 Java Servlet API,以鼓励开发人员采用模型-视图-控制器 (MVC) 架构。它最初由Craig McClanahan创建,并于 2000 年 5 月捐赠给了 Apache 基金会。

Listed below is the comparison chart of difference between Spring and Strut Framework

下面列出的是 Spring 和 Strut Framework 的区别对比图

enter image description here

在此处输入图片说明