01 is powered by Vocal.
Vocal is a platform that provides storytelling tools and engaged communities for writers, musicians, filmmakers, podcasters, and other creators to get discovered and fund their creativity.
How does Vocal work?
Creators share their stories on Vocal’s communities. In return, creators earn money when they are tipped and when their stories are read.
How do I join Vocal?
Vocal welcomes creators of all shapes and sizes. Join for free and start creating.
To learn more about Vocal, visit our resources.Show less
Enterprise Java is a high scale and reverse platform that is used to develop everything from small business websites to a company's back-end system. In fact, thousands of your favorite websites are running this ever-evolving platform. Let's now look at the architecture of the application.
Java Enterprise Edition Architecture
Java Enterprise Edition architecture is a component-based and an independent platform which makes it easy to write applications. The large box labelled Java EE in the picture represents the Java Enterprise Edition platform which is the run-time environment of a Java Application Server and this is called a container.
The Java EE container its self is made up of two other containers,
- Web container
- Enterprise Java Beans (EJB) container.
Web container is a part of Java EE environment which runs the web components in a Java EE application that include web pages, Java servlets, and other Java EE web components that acts as an interaction between clients and Java EE applications with the use of web protocols.
The EJB container is the other part of the Java EE environment which is specified to run the application logic of the Java EE application.
Java Enterprise Edition Server
Java EE server is a server which implements the applications API's with providing standard services in a standard way to the Java EE Platform. Following are some of the services provided by the server.
- Transfers Internet protocols to/from Web tier
- Access service endpoints
- Transfers RMI/IIOP to/from the business tier (EJB and CORBA clients)
- Gives messaging service for message oriented middleware
- Enables connectivity for RDMBs other EIS systems
- Locates program asset required to satisfy client's request
- Gives component life-cycle and multi-threading
- Constraints are applied when application is deployed
- Declares needed services in deployment descriptors for individual application or configures them the server for all applications.
Java Enterprise Edition Archive Files
Types of Archive Files
Java classes (POJO) are packaged in Java Archive (JAR)
- Built by IDE or SDK jar command
- Optional file manifest.mf specifies main class for Java SE
- Can be included in other modules or deployed to utility module
Web applications packages in Web Archive (WAR)
- Contains HTML, Java, images, css, etc. and all web assets
- It contains an optional deployment descriptor file web.xml
Connectors to EIS systems are in resource archives (RAR)
- Exception: JDBC drivers supplied by RDBMs vendors as a JAR
Enterprise applications packages in enterpirse archive (EAR)
- Contains an archive for each module in EAR
- Contains an optional deployment descriptor file application.xml
MVC Design Pattern in Java Enterprise Edition
- The web browser displays user interface.
- EJB reside in EJB container in Java EE server
- Web components like Servlets and JavaServer pages reside in Web container in Java EE server.
1. Role of Servlets in MVC
Servlets are Java classes that make up the controller layer
- Servlets control the web navigation.
According to MVC, servlets should:
- Receive HTTP request and get data from user
- Determine whether request can be performed. For example:
- If log in required, is user logged in
- Is input valid—prepare response to inform user if not
Call appropriate components to do business logic (model)
Get results from business logic
- Any post-processing of results required—prepare for display
- Handle exceptions from model tier
Forward result to JSP or appropriate HTTP response for display
2. Role of JSP Documents in MVC
JSP, HTML and files that browsers display up the view layer
JSP pages are XHTML documents plus extra tags
According to MVC, JSP pages should:
- Be the user interface (together with html and other web resources…)
- Implement the “look and feel” of the application
- Display HTML forms for user input
- Display dynamic content (results) prepared by servlets
- Using JSP Expression language and Java Template Library tags
- Submit requests for processing
- HTML <a href=“servlet alias” > or <form action=“servlet alias”>
- <a> can also link directly to other pages without invoking servlets
3. Model Layer Classes in MVC
The core business logic makes up model layer using intellectual capital of the organization creating the application
Core functionality knows nothing of user-interface or controller
- One model layer may have more than one user interface
- Changing the user interface does not affect on model
- Changing the model does not affect the UI unless the reason for the change is to add, remove or modify functionality
Servlet is the intermediary that connects each UI to the model
- Servlets must know what public methods to call on model
- Servlets must handle exceptions thrown by the model
- Servlets must know file and field names in the JSP/HTML