Skip to main content

BASIC CONCEPTS OF SPRING MVC IN OPENMRS


To start with, let us first know the basics and understand what is  spring model view controller

 Spring MVC
  It is a Java framework which is used to build web applications. It follows the Model-View-Controller design pattern.



The model here, contains the data of the application.
The view represents the provided information in a particular format.
The controller you can see here, contains the business logic of an application. Here, the @Controller annotation is used to mark the class as the controller.


Also In Spring Web MVC, the DispatcherServlet class works as the front controller. It is responsible to manage the flow of the Spring MVC application.

What is the flow of Spring Web MVC?
Your question is answered below,


As you can see, all the incoming requests are coming through the DispatcherServlet that acts as the front controller. The controller returns an object of ModelAndView. The DispatcherServlet checks the entry of view in the XML file.

Why should you use Spring MVC Framework?
1.      It uses light-weight server to develop your application.
2.      It provides powerful Configuration.
3.      The Spring MVC has a fast development.
4.      It allows you to use reusable business code It is Easy to test. 
5.      It allows flexible mapping.

Now let us understand the Source Code Structure in OpenMRS.
The OpenMRS source code is divided into three main segments:

·         The User Interface (focusing on the presentation)
·         The Service Layer (it layer is responsible for managing the business logic of the application)
·         The Data Access layer (The Data Access layer is an abstraction layer from the actual data model and its changes.)
The reason I introduced you to this structure is, because the User Interface layer for the legacy application is built upon Spring MVC, Direct Web Remoting (DWR), JSP and JavaScript. Spring MVC is used to provide the Model-View-Controller design pattern. For the new reference application user interface, OpenMRS no longer uses Spring MVC, DWR or JSP, but Groovy, JQuery, AngularJS, etc.

Spring MVC | OpenMRS
·         OpenMRS strongly subscribes to the Model-View-Controller pattern.
·         Most controllers included in the OpenMRS core will be SimpleFormControllers 
·         They  be placed in the org.openmrs.web.controller package.
·         The SpringController uses the mappings in the openmrs-servlet.xml file to know which pages are mapping to which Controller.
·         There are no jsp pages that are accessed directly.

If you want to read my information about spring controllers, check out my blog which is all about Spring Controllers : https://mygci19blog.blogspot.com/2019/12/spring-controllers.html




Comments

Popular posts from this blog

Google Code-In 2020 Wrap Up

"You do not need to be a programmer, you don’t have to know how to code at all!" is where it all started.    Google Code-in  ( GCI ) As its name suggests, is an annual programming competition hosted by Google that allows students to complete tasks specified by various open-source organizations. the organization which I chose was - OpenMRS.  What is OpenMRS?  OpenMRS is both a software and a community. It serves as a medical record system (EMR) which is designed for developing countries. OpenMRS follows a principle that information should be stored in a way that makes it easy to summarize and analyze. If you are interested in learning more about the OpenMRS community, you may go  here  and know more about it. If one would ask me to define OpenMRS in one line, it would be "we write code for humans first and then computers." as their main motto is to save lives.  My interactions in OpenMRS My interaction with OpenMRS ...