102 eClient 101 Customization and Integration
5.1 Introducing J2EE
J2EE stands for Java 2 Platform, Enterprise Edition. It defines a standard that
applies to all aspects of architecture and developing multi-tier server-based
applications.
J2EE applications are made up of components where each component is a
self-contained functional software unit. A component has its related classes and
files and communicates with other components.
Four types of components are defined:
Application clients: Java programs that execute on a client machine and
access other J2EE components.
Applets: Java components that execute on a client machine within a browser.
Web components: Servlets and JavaServer Pages (JSP) components that
run on the server and provide the controller and view functionality.
Enterprise JavaBeans (EJBs): Components that run on the server for
business logic and database access.
J2EE components are written in the Java programming language and are
compiled in the same way as any Java program. In addition, J2EE components
are assembled into a J2EE application, verified to be compliant with the J2EE
specification, and deployed to the J2EE server, where they are managed and
run.
To manage and run the components of a J2EE application, the J2EE server
defines four types of containers:
Application client container, a stand-alone Java runtime environment
Applet container, provided by the browser
Web component container, provided by the J2EE application server
Enterprise JavaBeans container, provided by the J2EE application server
The components use the services provided by the container either by
implementing interfaces or by calling certain APIs as defined in the J2EE
specification. J2EE components never interact with other J2EE components
directly; the interaction takes place using services provided by the containers.
Figure 5-1 on page 103 shows the components running in their containers.
Chapter 5. eClient architecture 103
Figure 5-1 J2EE components running in containers
J2EE applications benefit from the services and the scalability provided by the
J2EE servers. Because standard protocols are used, the interoperability with
other systems is ensured.
The WebSphere Studio Application Developer is an integrated development
environment for developing J2EE components as well as assembling and testing
J2EE applications. The WebSphere Application Server is a J2EE-compliant
server. It comes with the Application Assembly Tool, which can also be used to
assemble J2EE applications from existing components.
In the following section, we provide a short introduction to servlets and
JavaServer Pages (JSP) because the eClient is based on these technologies.
You need to change the JSPs and provide new servlets for the eClient
customization and integration.
If you are new to J2EE and need more information, the following steps should
help you to quickly learn everything about J2EE:
1. Download IBM WebSphere Studio Application Developer and IBM
WebSphere Application Server from:
http://www.software.ibm.com/wsdd
2. To learn the J2EE concepts and get sample codes, go to:
http://java.sun.com/j2ee/tutorial
Database
Database
Servlet JSP Page
Web Container
Web Container
J2EE Server
J2EE Server
Enterprise
Bean
Enterprise
Bean
EJB Container
EJB Container
Browser
Applet Container
Applet Container
Browser
Applet Container
Applet Container
Client Machine
Application
Client
Container
104 eClient 101 Customization and Integration
Implement, assemble and run the sample applications with the downloaded
products.
3. To learn about J2EE in a class, enroll in the course “Servlet and JSP
Development for WebSphere using WebSphere Studio Application Developer
V5.0” (course code WF311). The course catalog can be found at:
http://www.ibm.com/services/learning/us/catalog/websphere/all.html
5.1.1 What is a servlet?
A servlet is a Java programming language class used to extend the capabilities
of servers. Commonly, servlets are used to extend the applications hosted by
Web servers (HTTP servers). They are accessed via a request-response
programming model. Figure 5-2 shows how this works with the WebSphere
Application Server.
Figure 5-2 Servlet requests and responses in WebSphere Application Server
The client sends a request to the HTTP server that has a plug-in installed that
uses a configuration file to determine whether the request should be handled by
the HTTP server or the application server. Using the standard HTTP or the
secure HTTPS, the request is forwarded to the application server, which calls a
servlet to process the request. The response is returned to the client.
Embedded
HTTP server
Application Server
Application Server
Web container
Servlet
Servlet
Servlet
Web
browser
client
HTTP server
plug-in
Get eClient 101 Customization and Integration now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.