May 2006, Java EE 5 specification released. Java EE 5, there may be more heavyweight J2EE since the birth of a shock, standard has been released as much as six months, the industry's attention on the Java EE 5 has become increasingly heated, google about "java ee" keyword , can be related to more than 500 million records from the Sun Web site to search (http://java.sun.com/javaee/overview/compatibility.jsp), we can see the professional firms have been quick to follow up, in addition to Sun the company itself, including the world famous SAP, Kingdee Apusic so another three, has launched full support for Java EE 5 application server products specifications.
Java EE 5 includes JSF 1.2, EJB 3.0 and JAX-WS 2.0 and other new features, trying to solve the Java enterprise application development simplicity, flexibility and ease of use. Before the advent of the Java EE 5, and many open source frameworks (Open Source Framework) have sprung up, or somehow try to solve some aspects of the "Commission" failed to take into account the specification of application development issues, such as Web Development Separation of concerns (MVC), business model implementation issues (ORM) and so on. Many open-source framework is very famous and widely used for people to love, such as Struts, Spring, Hibernate, etc., these "Wild School" works to some extent has become a Java enterprise application development, the de facto standard. The emergence of Java EE 5, will change this situation? In other words, people choose to re-application framework, will give priority to the new Java EE 5 technology? With this question, the author tried to compare a simple technology, and assisted in the superficial comments, hope to initiate Jiehuaxianfo to entertain the public.
Struts vs. JSF
Struts JSF
MVC support support
POJO support
Page Flow (Page Flow) Support Support
UI Components (UI Component) support
MVC is a model (Model), view (View), control (Controller) hierarchical structure, to achieve separation of concerns through stratified to reduce the traditional development of common and repetitive tasks. Struts and JSF support the MVC. Struts support is the core of the MVC Controller, through the Controller (a common entrance Servlet) received HTTP request, the HTTP parameters passed ActionForm, and then passed to Action class ActionForm. Struts on the HTTP request processing only one event handler, when the request came, by the results returned to the front of the corresponding Action Controller, and thus choose how to navigate. JSF generally use a front-end Controller (some commercial JSF to JSF request identification without the need for extra controller), but to do the work in the Controller with the Struts Controller different, it is responsible for triggering the events JSF page components, to use Render Tools The show generated components, binding data from the Model to the components. Can be seen, JSF is more flexible in the control layer, in the view layer to support the transformation and generate Render tools show flexibility in the model layer and the framework to achieve a complete separation, so it has more flexibility.
POJO is a plain Java objects (Plain Old Java Object). POJO integration with AOP is widely used in rapid business model. Struts design are designed mainly to solve the problem view and control, not too concerned about the issue of flexibility in the model. Struts ActionForm in the model must inherit from the framework of the class, although you can customize the library to provide some help to achieve model class has nothing to do with the framework, but the essence is still tightly coupled to JSP-and HTTP-centric approach. POJO JSF provides a natural good support, and support the RAD tools for rapid generation of business models, which have higher productivity.
Greatest significance is the page navigation to help achieve the page visual development, rapid definition of the interface in the UI page flow. Page navigation sub-navigation and dynamic navigation are two static, static navigation is to direct the flow of the page to another page, dynamic navigation is decided by a specific action or logical flow of the page. Struts and JSF support static and dynamic page navigation. However, Struts in Action navigation rules is bound to the, that means the same page may need to do the different Action repetitive navigation rule-making, while the JSF navigation could be nothing to do with Action can be different components in the page Action between different share the same navigation rules.
Struts itself does not provide UI component mechanism, and provides a complete JSF UI component mechanism. Through UI customization and reuse of components, can greatly simplify development, improve the user experience. Commercial products is often step further, providing a powerful and easy to use development tools, to achieve drag-and-drop WYSIWYG Web UI development way.
Spring vs. EJB 3.0
Spring EJB3
Standard (Standard) 是, Java EE 5 standard component
Persistence (Persistence) JDBC, Hibernate, JDO, iBatis and JPA (ongoing spring 2.0) JPA
Declarative Services (Declarative Services) Support Support
Dependency injection (Dependency Injection) Support Support
Cluster (Cluster) support
Spring Framework is an open source project, not a standard thing. Spring defines its own set of XML configuration files and program interface framework, the longer term, there is great uncertainty. Spring's main developer from Interface21, Inc. (This is to help people who I greatly respect), Interface21 by related advice and services to maintain their interests as a business group orientation will be entirely about the future direction of Spring. Upright than the standard EJB 3 well-born race and there are many mainstream commercial vendor support, Spring's non-standard may cause great risk.
Spring Framework itself does not bring lasting achieve, but it supports JDBC, Hibernate, JDO and iBatis persistence framework such as. Spring DAO and by using different Helper Class to use JDBC, Hibernate, iBatis, or JDO, and there is no ultimate service providers to achieve and isolation. In short, is the need to refactor the code to achieve the replacement of persistence framework. EJB 3.0 persistence integrated application services, by JPA, lasting change in the underlying implementation, if the replacement Hibernate Toplink. EJB 3.0 persistence greater flexibility, and help manufacturers to optimize performance and expansion.
Spring and EJB3.0 are running for the enterprise applications services (such as: transaction, security, log messages, configuration service). Because these services are not directly associated with the application business logic, so are not managed by the application from the line. EJB3.0 using Java annotation to configure the Declarative Services, Spring uses XML configuration files. In most cases, EJB3.0 notes the more simple and elegant statement. Spring uses XML to define properties and configure the declarative services, the result will be a long and stable profile.
Dependency injection pattern (DI) is in the application of best practices to achieve loose coupling. Spring and EJB3.0 support the DI model, but they have a profoundly different. Spring support for common (but complex) dependency on XML configuration file into the API. EJB3.0 support services into the majority of objects (such as EJB and context objects) and notes the statement by simple JNDI object.
EJB 3.0 fully supports the cluster. Deployed in the service cluster EJB3.0 application will automatically load balancing, distributed caching, state replication and other functions. Bottom of the cluster service programming interface EJB3.0 hidden behind a mask all the complexity. Spring is no simple way to use the cluster.
Hibernate vs. EJB 3.0
ibernate and EJB 3.0 is not very good in fact comparable, as Hibernate is concerned only with ORM, but EJB 3.0 is more performance more as a component framework, which contains the ORM part of it. EJB 3.0 in the design process, have benefited from Hibernate author Gavin King, is said to EJB 3.0 EntityBean the design completely from Hibernate. Simply use the EJB 3.0 EntityBean API calls into Hibernate API, Hibernate in EJB 3.0 can be EntityBean of Implementation.
When the open-source framework has become customary force, and gave rise to a number of fun or fatigue when, Java EE 5 is the right time to the appearance of it? In any case, is to choose or to embrace open source Java EE 5? Believe that today this is not an easy choice, perhaps, as more manufacturers release products that support Java EE 5, better tool support, the answer will clear up.