03 Apr 2020

ROLE OF MVC IN JAVA ENTERPRISE APPLICATION DEVELOPMENT

INTRODUCTION

MVC(Model-View-Controller) is very useful for developing Applications. It has become the most powerful and leading Programming Paradigm for developing large scale and Dynamic Web Applications. Through MVC, developers can trust on architecture that are extensively accepted as solutions for frequent problems and used to develop flexible, reusable and modular Application. Applying the Model-View-Controller design pattern to Enterprise Applications is therefore complicated by the fact that current technologies inspire developers to partition the application as early as in the design phase.

MVC Architecture is a modern Design Pattern of developing Applications. It is separate the application into three main Layers: Model, View and Controller. The Model contain the Business Services that process the application data and also stores or retrieves data to or from the database. The View displays information to the user and the Controller handles user interactions and input.

Figure 1: MVC Design Pattern

J2EE FRAMEWORK

J2EE is a platform-independent, Java-centric environment from Oracle for developing, building and deploying web-based enterprise applications. The J2EE platform consists of a set of services, APIs, and protocols that provide the functionality for developing multi-tiered, web-based applications. Enterprise applications provide the business logic for an enterprise. They are centrally managed and often interact with other enterprise software. J2EE provides a way to develop distributed, transactional, and portable applications that leverage the speed, security, and reliability of server-side technology. The aim of the Java EE platform is to provide enterprise application developers with a powerful set of APIs while shortening development time, reducing application complexity, and improving application performance.

In a J2EE based application, the MVC architecture is used for separating the business layer functionality represented by JavaBeans or EJBs (the model) from the presentation layer functionality represented by JSPs (the view) using an intermediate servlet-based controller. A controller accommodates input from various types of clients including HTTP requests from web clients, WML from wireless clients, and XML-based documents from suppliers and business partners. For the HTTP Request/Response paradigm, incoming HTTP requests are routed to a central controller, which in turn interprets and delegates the request to the appropriate request handlers. This is also referred to as MVC Type-II (Model 2) Architecture. Figure 2 shows MVC Architecture in the J2EE framework. Request handlers are hooks into the framework provided to the developers for implementing request specific logic that interacts with the model. Depending on the outcome of this interaction, the controller can decided the next view for generating the correct response

Figure 2: J2EE MVC Framework


In Enterprise Applications in Java, The Models where developed using Enterprise Java Beans (EJB) and the Java API(JPA), the View where developed using Java Server Page (JSP) or Java Server Faces (JSF), The Controllers where developed using Java Servlets(.java) or ManagedBean(.java). The given figure shows the MVC design pattern using Enterprise Java.

CONCLUSION

MVC is a Software Architecture built around the interconnection of three main component types: Model, View, and Controller, often with a strong focus Enterprise Application paradigm. MVC is a framework for building Enterprise applications using an MVC design. The MVC is very useful for developing Interactive and Dynamic Web Applications. It has become the most powerful and leading Programming Paradigm for developing large scale and Dynamic Web Applications. Here we have shown the role of an Enterprise based application using MVC framework using Java Enterprise Architecture.

Author –
R.N. Thakur
Program Coordinator - M.Sc. (ITM)
LBEF Campus