2013年11月26日 星期二

java-framework


http://stackoverflow.com/questions/2841212/what-is-the-difference-between-spring-struts-hibernate-javaserver-faces-tape

in the hibernate u need not bother about how to create table in sql and u need not to remember connection ,preapred statment like that data is stored in persistance way in data base....it makes devloper life easy

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.


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.
Struts is an action-based presentation framework (but don't use it for a new development).
Struts 2 is an action-based presentation framework, the version 2 of the above (created from a merge of WebWork with Struts).
Hibernate is an object-relational mapping tool, a persistence framework.
JavaServer Faces is component-based presentation framework.
JavaServer Pages is a view technology used by all mentioned presentation framework for the view.
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.

Generally...

Hibernate is used for handling database operation. There are rich set of database utility functionality, which reduce your number of lines of code. Especially you have to read @Annotation of hibernate. It is ORM framework, persistance layer.

Spring provides rich set of Injectioin based working mechanism. Currently Spring become so much famous. You have to also read about Spring AOP. There is bridge between Struts and Hibernate. Mainly Spring provides this kind of utility.

Struts2 provides action based programming. There are rich set of Struts tags. You can use it. Struts proves action based programming so you have to maintain all the relavant control of your view.

In Addition Tapestry is different framework of JAva. In which you have to handle only .tml (template file). YOu have to create main 2 files for any class. One is JAVA class and another one is its template. Both name's are same. Tapestry automatically called related classes.

沒有留言:

張貼留言