Java EE(Java Enterprise Edition)

Java EE was built by Sun Microsystems in collaboration with IBM. It was originally created to simplify application development and reduce the amount of code writing by creating standard modules and components that can automate processes.

Image for post
Image for post

The main objective of Java EE is to simplify common problems faced by developers when it comes to building modern applications through different APIs. Some prominent APIs that come with Java EE includes Servlet, JavaServer Pages (JSP), Java Persistence API (JPA), Enterprise JavaBeans (EJB), JSP Standard Tag Library (JSTL), Java EE containers, etc.

Today we are going to see different architecture’s of J2EE: —

1.Model 1 —

When java EE comes, there were no servlets so, at that time we use JSP for sending request and receiving output. How it works?

Image for post
Image for post

In above image we have model1 architecture, in this browser send request to the JSP 1, and then JSP 1 directly talk to the business layer or Model and it would send response back to the JSP 1, and JSP 1 sends response to the browser, after receiving response from one JSP, browser sends another request to other JSP 2, same process followed by JSP 2 also. Here JSP is nothing but servlet.

2.Model 2(Model View Controller):-

In model 1 it is very difficult for JSP’s to handle all java files in JSP file.

Image for post
Image for post

In model 2 or MVC , browser sends request to the specific servlet, then servlet talks to model or business layer, create an model and make it available to the view , here view generates an html page and send it as a response to the browser. Once the browser receive the response, it sends an request to another servlet.

For ex:- you have an website where there are two pages, one for login and another for shopping, so first browser sends request to login servlet, once it gets the response, only then it send another request to shopping servlet.

Servlets acts as a controller, decides that, which particular model needs to be created and should be given for a particular view.

3. Model 3(Front Controller):-

Image for post
Image for post

This model is same as MVC, but here another layer of front controller is added, here front controller acts as a single servlet which decided which controller should invoke. Controller talks to the business layer or model, here model decides which particular view needs to be called, then view generates an html page and send back to the front controller..

Thanks for giving your valuable time

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store