Integration of Struts, Spring and Hibernate for an University ... - IJETAE

15 downloads 466 Views 480KB Size Report
system using the integration of Spring, Hibernate and Struts framework. Keywords ..... can access the research papers, download them can also browse the ...
International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, Volume 2, Issue 6, June 2012)

Integration of Struts, Spring and Hibernate for an University Management System Ankur Bawiskar1, Prashant Sawant2, Vinayak Kankate3, Dr. B.B.Meshram4 1,2,3

4

Department of Computer Technology, Veermata Jijabai Technological Institute,Matunga, Mumbai, India Head of Department of Computer Technology, Veermata Jijabai Technological Institute, Matunga, Mumbai, India

Abstract - This paper presents the concept of the Spring framework which is widely used in making enterprise wide applications along with other frameworks. Spring framework insists that ordinary java beans can be used with slight modifications to them. This framework is used within J2EE architecture to make it easier to develop large scale java applications. This paper presents the architecture overview of spring framework along with the features of the framework that have made the framework useful for using it along with struts and hibernate. The integration of various frameworks for an E-commerce system such as university system has also been discussed in the paper. The Spring MVC framework as an important part is also discussed along with struts mvc. This paper has a proposed architecture for a website based system using the integration of Spring, Hibernate and Struts framework.

Fig 1 Architecture of Spring Framework

The architecture of spring consists of seven modules which can be shown as follows [2]:

Keywords - AOP, Dispatcher, E-commerce, Hibernate, Integration, IoC, JavaEE, Mapping file, MVC, Spring, Struts

I.

 The core container  Spring context  Spring AOP  Spring DAO  Spring ORM  Spring Web Module  Spring MVC framework b. Features of Spring framework Spring is a free and open source framework that offers a lot of functions to developers and programmers. It was created by Rod Johnson and Juergen Hoeller jointly. The most important features of it are the Inversion of Control, Aspect oriented programming and Spring MVC. Spring has its own MVC framework that can be used with other frameworks or can be used alone. The Aspect oriented programming, IoC and MVC are the important features that facilitates the development of an enterprise applications. Aspect oriented Programming: Taking the help of AOP the various concerns present in a system can be easily separated out. Aspects can be transaction, logging and security. In Spring aspects are bundled together with the help of spring configuration file which is a xml file and coding is well modularized. [10] Example: consider the example of hotel booking system.

INTRODUCTION

In today’s world, with the introduction of information technology and communication media many of the companies use frameworks for making the development of their applications easier. The business today demands web applications to advertise its company so it is very important to take care of the architecture used in development of the application. Framework can be considered as a set of functions helping the developers in creating the applications. The Spring Framework is an application type framework that helps to customize java applications effectively. Even though JavaEE is widely used, it has some limitations such as reusability of code is very less, heavy development burden present [1], [5]. Spring framework when used with JavaEE makes the development easier. Spring is a layered architecture so whenever an Ecommerce system is developed using spring it has clear separation of the layers. Because of its layered architecture it allows users to select about which of its components users can use. II. a.

RELATED W ORK

Architecture of Spring framework

203

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, Volume 2, Issue 6, June 2012)  DispatcherServlet- It receives the request transferred to it by web.xml file.  Controller- It handles the request and is created by user. They are objects that can respond to the actions a user takes like form filling or clicking a link.  View- It can be thought of as a way of representing the output to the end users.  ModelAndView- Whenever a request come it’s the job of ModelAndView to associate the view to the particular request. It is created by controller and when it executes it returns data and name of view.  ViewResolver- It tries to resolve the view based on the output given by ModelAndView object and select the output media. There can be various output media present for the particular system or application.  HandlerMapping-Whenever DispatcherServlet receives incoming requests it associates the request to individual controllers with the help of this component. The MVC model of Spring can be shown as below [6]:

The various types of services such as guest service, room service and staff service need the functionality provided by Logging, Security, and Transaction modules. The normal system for this would be as follows [6]:

Fig 2 Normal System without AOP

The same system with the help of AOP feature of spring can be drawn as follows: All the three functionalities are provided to all the three services which can be showed as below: [6]

Fig 4 Handling of request using Spring MVC

d.

Struts MVC framework The application has central controller- a heart of framework struts (ActionServlet), which mediates between all requests and separate them to individual objects. Those objects are the bridge between the application model and assigned to it request. The model presents the application state. If the state is changed, control will be forwarded to the given view. This, to what view the control will be forwarded, is the most frequently specified in the mapping file. [31]

Fig 3 Approach using AOP

Inversion of Control: In the IoC instead application calling the framework, it is the framework that calls the components specified by an application. The dependencies are injected dynamically at run time by the container of Spring. c. Spring MVC model The Spring Framework has its own MVC model. The major components of Spring MVC are as follows [3]:

204

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, Volume 2, Issue 6, June 2012) The above xml file specify that the property name is for hibernate framework and two property keys can be defined and are necessary for a web application they are “hibernate.dialect” and “hibernate.show_sql”. It also specifies the connection pool size. Hibernate also provide two level cache strategy that will help in retrieving the information from database in less time. Hibernate can save common data that is being frequently being retrieved by using the caching technology. When client request for a data the cache is visited first, if the data can be found from the cache it is directly sent to the user otherwise the request is sent to database again thereby increasing the speed of request and response. f. Hibernate Mapping file The Hibernate layer is called as persistence layer. Database records are mapped into Java objects based on XML definitions stored in Hibernate’s configuration files. An example mapping file can be shown as below: [32]