19
Introduction To J2EE Frameworks Presenter Mukesh Jha Email- [email protected]

Introduction to j2 ee frameworks

Embed Size (px)

Citation preview

Page 1: Introduction to j2 ee frameworks

Introduction To J2EE Frameworks

Presenter Mukesh Jha

Email- [email protected]

Page 2: Introduction to j2 ee frameworks

What is Software Framework

A software framework is a universal, reusable software environment that provides particular functionality as part of a larger software platform to facilitate development of software applications, products and solutions.

Page 3: Introduction to j2 ee frameworks

J2EE Frameworks

1. Struts 1.0 and 2.x

2. Hibernate 3.0

3. Spring 3.1

4. JSF 2.0

Page 4: Introduction to j2 ee frameworks

MVC

Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications. A Model View Controller pattern is made up of the following three parts:

Model - The lowest level of the pattern which is responsible for maintaining data.

View - This is responsible for displaying all or a portion of the data to the user.

Controller - Software Code that controls the interactions between the Model and View.

MVC is popular as it isolates the application logic from the user interface layer and supports separation of concerns. Here the Controller receives all requests for the application and then works with the Model to prepare any data needed by the View. The View then uses the data prepared by the Controller to generate a final presentable response. The MVC abstraction can be graphically represented as follows.

Page 5: Introduction to j2 ee frameworks

Struts 2.

1. Based On MVC 2 architecture .

Page 6: Introduction to j2 ee frameworks

Struts 2 Features 1. POJO forms and POJO actions - Struts2 has done away with the Action Forms that were an integral part of the Struts framework. With Struts2, you can use any POJO to receive the form input. Similarly, you can now see any POJO as an Action class.

2. Tag support - Struts2 has improved the form tags and the new tags allow the developers to write less code.

3.AJAX support - Struts2 has recognised the take over by Web2.0 technologies, and has integrated AJAX support into the product by creating AJAX tags, that function very similar to the standard Struts2 tags.

4 .Easy Integration - Integration with other frameworks like Spring, Tiles and SiteMesh is now easier with a variety of integration available with Struts2.

5. Template Support - Support for generating views using templates.

6. Plugin Support - The core Struts2 behaviour can be enhanced and augmented by the use of plugins. A number of plugins are available for Struts2.

7. Profiling - Struts2 offers integrated profiling to debug and profile the application. In addition to this, Struts also offers integrated debugging with the help of built in debugging tools.

8.Easy to modify tags - Tag markups in Struts2 can be tweaked using Freemarker templates. This does not require JSP or java knowledge. Basic HTML, XML and CSS knowledge is enough to modify the tags.

9.Promote less configuration - Struts2 promotes less configuration with the help of using default values for various settings. You don't have to configure something unless it deviates from the default settings set by Struts2.

10.View Technologies: - Struts2 has a great support for multiple view options (JSP, Freemarker, Velocity and XSLT)

Page 7: Introduction to j2 ee frameworks

Hibernate1)Hibernate is an Object-Relational Mapping(ORM) solution for JAVA and it raised as an open source persistent framework created by Gavin King in 2001. It is a powerful, high performance Object-Relational Persistence and Query service for any Java Application.

2 )Hibernate maps Java classes to database tables and from Java data types to SQL data types and relieve the developer from 95% of common data persistence related programming tasks.

Page 8: Introduction to j2 ee frameworks

Hibernate Advantage

• Hibernate takes care of mapping Java classes to database tables using XML files and without writing any line of code.

• Provides simple APIs for storing and retrieving Java objects directly to and from the database.

• If there is change in Database or in any table then the only need to change XML file properties.

• Abstract away the unfamiliar SQL types and provide us to work around familiar Java Objects.

• Hibernate does not require an application server to operate.

• Manipulates Complex associations of objects of your database.

• Minimize database access with smart fetching strategies.

• Provides Simple querying of data.

Page 9: Introduction to j2 ee frameworks

Hibernate Architecture

Page 10: Introduction to j2 ee frameworks

Key Component Of Hibernate

• Configuration Object

• Session Factory Object

• Session Object

• Transaction Object

• Query Object

• Criteria Object

Page 11: Introduction to j2 ee frameworks

Spring Framework

• Spring framework is an open source Java platform and it was initially written by Rod Johnson and was first released under the Apache 2.0 license in June 2003.

• The core features of the Spring Framework can be used in developing any Java application, but there are extensions for building web applications on top of the Java EE platform. Spring framework targets to make J2EE development easier to use and promote good programming practice by enabling a POJO-based programming model

Page 12: Introduction to j2 ee frameworks

Spring Architecture

Page 13: Introduction to j2 ee frameworks

Spring Framework key components

• The core container: The core container provides the essential functionality of the Spring framework. A primary component of the corecontainer is the BeanFactory, an implementation of the Factory pattern. The BeanFactory applies the Inversion of Control (IOC) patternto separate an application’s configuration and dependency specification from the actual application code.

• Spring context: The Spring context is a configuration file that provides context information to the Spring framework. The Spring contextincludes enterprise services such as JNDI, EJB, e-mail, internalization, validation, and scheduling functionality.

• Spring AOP: The Spring AOP module integrates aspect-oriented programming functionality directly into the Spring framework, throughits configuration management feature. As a result you can easily AOP-enable any object managed by the Spring framework. The SpringAOP module provides transaction management services for objects in any Spring-based application. With Spring AOP you canincorporate declarative transaction management into your applications without relying on EJB components.

• Spring DAO: The Spring JDBC DAO abstraction layer offers a meaningful exception hierarchy for managing the exception handling anderror messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces theamount of exception code you need to write, such as opening and closing connections. Spring DAO’s JDBC-oriented exceptions complyto its generic DAO exception hierarchy.

• Spring ORM: The Spring framework plugs into several ORM frameworks to provide its Object Relational tool, including JDO, Hibernate,and iBatis SQL Maps. All of these comply to Spring’s generic transaction and DAO exception hierarchies.

• Spring Web module: The Web context module builds on top of the application context module, providing contexts for Web-basedapplications. As a result, the Spring framework supports integration with Jakarta Struts. The Web module also eases the tasks ofhandling multi-part requests and binding request parameters to domain objects.

Page 14: Introduction to j2 ee frameworks

Java Server Face(JSF)

• JavaServer Faces (JSF) is a Java-based web application framework intended to simplify development integration of web-based user interfaces. JavaServer Faces is a standardized display technology which was formalized in a specification through the Java Community Process.

Page 15: Introduction to j2 ee frameworks

JSF Architecture

Page 16: Introduction to j2 ee frameworks

JSF Architecture

• JavaBeans components as models containing application-specific functionality and data

• A custom tag library for representing event handlers and validators

• A custom tag library for rendering UI components

• UI components represented as stateful objects on the server

• Server-side helper classes

• Validators, event handlers, and navigation handlers

• Application configuration resource file for configuring application resources

• JSF Architecture

Page 17: Introduction to j2 ee frameworks

JSF Life Cycle

Page 18: Introduction to j2 ee frameworks

JSF Life Cycle

• Phase 1: Restore view

• Phase 2: Apply request values

• Phase 3: Process validation

• Phase 4: Update model values

• Phase 5: Invoke application

• Phase 6: Render response

Page 19: Introduction to j2 ee frameworks

Thanks

• Presenter -- Mukesh Jha

Email -- [email protected]

Employee – ITC Infotech(Sigma Aldrich)