201

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

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
CMW
  • 2,367
  • 4
  • 19
  • 10

9 Answers9

267
  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.

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 framework and 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.

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 serious option, Java EE 6 is a great stack.

See also

Community
  • 1
  • 1
Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • 2
    I'd like to point out that in this sort of comparison context some people also use the word Spring to refer to its own MVC framework (which is much nicer than Struts IMO). – MetroidFan2002 May 16 '10 at 02:14
  • Nicely explained, but still it's too technical. I'd advise you to explain it in layman term. Anyways the links at the end did that. – 0xC0DED00D Nov 05 '13 at 02:10
  • The answer is a great starting point indeed, but could be improved upon by explaining the main concepts introduced (request based vs component based frameworks, IoC containers, Presentation vs persistence framework... ) As it stands now, it requires a lot of additional googeling, but it is still a good answer, and great starting point! Upvote. – Wouter Jan 25 '17 at 13:49
19

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.

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.

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.

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.

Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
Pradip Bhatt
  • 668
  • 9
  • 15
7

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.

Srikar Doddi
  • 15,499
  • 15
  • 65
  • 106
4

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

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

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

Robin Topper
  • 2,295
  • 1
  • 17
  • 25
Nishat Lakhani
  • 733
  • 1
  • 8
  • 20
3

In short,

Struts is for Front-end development of website

Hibernate is for back-end development of website

Spring is 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

Prabhu
  • 96
  • 1
  • 10
tushi43
  • 60
  • 1
  • 6
2

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.

Utsav T
  • 1,515
  • 2
  • 24
  • 42
dipak
  • 45
  • 1
2

Spring is a light weight and open source framework created by Rod Johnson in 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.

Struts is 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 McClanahan and donated to the Apache Foundation in May, 2000.

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

enter image description here

VyTcdc
  • 986
  • 10
  • 32
0

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

Nishat Lakhani
  • 733
  • 1
  • 8
  • 20
0

Difference between Spring, Struts and Hibernate are following:

  1. Spring is an Application Framework but Struts and hibernate is not.
  2. Spring and Hibernate are Light weighted but Struts 2 is not.
  3. Spring and Hibernate has layered architecture but Struts 2 doesn't.
  4. Spring and Hibernate support loose coupling but Struts 2 doesn't.
  5. Struts 2 and Hibernate have tag library but Spring doesn't.
  6. Spring and Hibernate have easy integration with ORM technologies but Struts doesn't.
  7. Struts 2 has easy integration with client-side technologies but Spring and Hibernate don't have.
Raman Gupta
  • 1,580
  • 15
  • 12