0% found this document useful (0 votes)
19 views

Department of Computer Science and Engineering: Subject Name: Platform Technology Subject Code: CS T73

Mercedes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Department of Computer Science and Engineering: Subject Name: Platform Technology Subject Code: CS T73

Mercedes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 36

SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

Department of Computer Science and Engineering

Subject Name: PLATFORM TECHNOLOGY Subject Code: CS T73

Prepared by:
Dr. E. KODHAI, Prof/CSE
Mr. M. SHANMUGAM, AP/CSE
Dr. V. VIJAYAKUMAR, Assoc. Prof/CSE

Verified by: Approved by:

UNIT V

J2EE: Enterprise Edition Overview - Multi-Tier Architecture - Best Practices-Comparison


between J2EE and .NET

CS T54 - PLATFORM TECHNOLOGY 1


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

UNIT V
2 Marks
1. What is J2EE?
J2EE is an environment for developing and deploying enterprise applications. The J2EE
platform consists of a set of services, application programming interfaces (APIs), and protocols
that provide the functionality for developing multi-tiered, web-based applications.
2. What are the components of J2EE application?
A J2EE component is a self-contained functional software unit that is assembled into a
J2EE application with its related classes and files and communicates with other components. The
J2EE specification defines the following J2EE components:
 Application clients and applets are client components.
 Java Servlet and JavaServer Pages technology components are web components.
 Enterprise JavaBeans components (enterprise beans) are business components.
 Resource adapter components provided by EIS and tool vendors.

3. What are the features of J2EE? (Nov 2018)


Features of J2EE:
 Component based model

 Container provided services

 Highly Scalable

 Simplified Architecture

 Flexible security model

4. Write about the J2EE architecture? (Nov 2018)

J2EE architecture supports component-based development of multi-tier enterprise


applications. A J2EE application system typically includes the following tiers:

 Client tier: In the client tier, Web components, such as Servlets and JavaServer Pages
(JSPs), or standalone Java applications provide a dynamic interface to the middle tier.
 Middle tier: In the server tier, or middle tier, enterprise beans and Web Services
encapsulate reusable, distributable business logic for the application. These server-tier
components are contained on a J2EE Application Server, which provides the platform for
these components to perform actions and store data.

CS T54 - PLATFORM TECHNOLOGY 2


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

 Enterprise data tier: In the data tier, the enterprise's data is stored and persisted,
typically in a relational database.
5. What makes J2EE suitable for distributed multitiered Applications?
The J2EE platform uses a multitiered distributed application model. Application logic is
divided into components according to function, and the various application components that
make up a J2EE application are installed on different machines depending on the tier in the
multitiered J2EE environment to which the application component belongs. The J2EE
application parts are:
 Client-tier components run on the client machine.
 Web-tier components run on the J2EE server.
 Business-tier components run on the J2EE server.
 Enterprise information system (EIS)-tier software runs on the EIS server.

6. What are the supporting J2EE APIs?


J2EE provides a number of “supporting” APIs. The purpose of most of these APIs is to
enable interaction between the “main” software layers/components in the J2EE architecture.
•Remote Method Interface (RMI)
•Java Naming and Directory Interface (JNDI)
•Java Message Service (JMS)
•Java Transaction API (JTA)
•Java Database Connectivity (JDBC) / SQLJ
•JavaMail /JMC

7. What do Enterprise JavaBeans components contain?


Enterprise JavaBeans components contains Business code, which is logic that solves or
meets the needs of a particular business domain such as banking, retail, or finance, is handled by
enterprise beans running in the business tier. All the business code is contained inside an
Enterprise Bean which receives data from client programs, processes it (if necessary), and sends
it to the enterprise information system tier for storage. An enterprise bean also retrieves data
from storage, processes it (if necessary), and sends it back to the client program
8. What can be considered as a web component?
J2EE Web components can be either servlets or JSP pages. Servlets are Java
programming language classes that dynamically process requests and construct responses. JSP
pages are text-based documents that execute as servlets but allow a more natural approach to
creating static content.

CS T54 - PLATFORM TECHNOLOGY 3


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

9. What is the container?


Containers are the interface between a component and the low-level platform specific
functionality that supports the component. Before a Web, enterprise bean, or application client
component can be executed, it must be assembled into a J2EE application and deployed into its
container.
10. What is the web container?
Servlet and JSP containers are collectively referred to as Web containers. It manages the
execution of JSP page and servlet components for J2EE applications. Web components and their
container run on the J2EE server.
11. What is Enterprise JavaBeans (EJB) container?
It manages the execution of enterprise beans for J2EE applications.
Enterprise beans and their container run on the J2EE server.
12. What are container services?
A container is a runtime support of a system-level entity. Containers provide components
with services such as lifecycle management, security, deployment, and threading.
13. What is the web container?
Servlet and JSP containers are collectively referred to as Web containers. It manages the
execution of JSP page and servlet components for J2EE applications. Web components and their
container run on the J2EE server.
14. What is Enterprise JavaBeans (EJB) container?
It manages the execution of enterprise beans for J2EE applications.
Enterprise beans and their container run on the J2EE server.
15. What is Applet container?
Manages the execution of applets. Consists of a Web browser and Java Plugin running on
the client together.
16. How do we package J2EE components?
J2EE components are packaged separately and bundled into a J2EE application for
deployment. Each component, its related files such as GIF and HTML files or server-side utility
classes, and a deployment descriptor are assembled into a module and added to the J2EE
application. A J2EE application is composed of one or more enterprise bean,Web, or application
client component modules. The final enterprise solution can use one J2EE application or be
made up of two or more J2EE applications, depending on design requirements. A J2EE
application and each of its modules has its own deployment descriptor. A deployment descriptor
is an XML document with an .xml extension that describes a component’s deployment settings.
CS T54 - PLATFORM TECHNOLOGY 4
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

17. What are types of J2EE clients?


Following are the types of J2EE clients:
 Applets
 Application clients
 Java Web Start-enabled rich clients, powered by Java Web Start technology.
 Wireless clients, based on Mobile Information Device Profile (MIDP) technology.

18. What is deployment descriptor?


A deployment descriptor is an Extensible Markup Language (XML) text-based file with
an .xml extension that describes a component’s deployment settings. A J2EE application and
each of its modules has its own deployment descriptor. For example, an enterprise bean module
deployment descriptor declares transaction attributes and security authorization for an enterprise
bean. Because deployment descriptor information is declarative, it can be changed without
modifying the bean source code. At run time, the J2EE server reads the deployment descriptor
and acts upon the component accordingly.
19. What is the EAR file?
An EAR file is a standard JAR file with an .ear extension, named from Enterprise
ARchive file. A J2EE application with all of its modules is delivered in EAR file.
20. What is JTA and JTS?
JTA is the abbreviation for the Java Transaction API. JTS is the abbreviation for the Jave
Transaction Service. JTA provides a standard interface and allows you to demarcate transactions
in a manner that is independent of the transaction manager implementation. The J2EE SDK
implements the transaction manager with JTS. Therefore, JTA is a high level transaction
interface that your application uses to control transaction. and JTS is a low level transaction
interface and ejb uses behind the scenes (client code doesn’t directly interact with JTS. It is
based on object transaction service(OTS) which is part of CORBA.
21. What is JAXP?
JAXP stands for Java API for XML. XML is a language for representing and describing
text-based data which can be read and handled by any program or tool that uses XML APIs. It
provides standard services to determine the type of an arbitrary piece of data, encapsulate access
to it, discover the operations available on it, and create the appropriate JavaBeans component to
perform those operations.
22. What is J2EE Connector?
The J2EE Connector API is used by J2EE tools vendors and system integrators to create
resource adapters that support access to enterprise information systems that can be plugged into

CS T54 - PLATFORM TECHNOLOGY 5


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

any J2EE product. Each type of database or EIS has a different resource adapter. Note: A
resource adapter is a software component that allows J2EE application components to access and
interact with the underlying resource manager. Because a resource adapter is specific to its
resource manager, there is typically a different resource adapter for each type of database or
enterprise information system.
23. What is JAAP?
The Java Authentication and Authorization Service (JAAS) provides a way for a J2EE
application to authenticate and authorize a specific user or group of users to run it. It is a
standard Pluggable Authentication Module (PAM) framework that extends the Java 2 platform
security architecture to support user-based authorization.
24. Explain about the J2EE multi tier application?
J2EE multi-tiered applications are generally considered to be three-tiered applications
because they are distributed over three different locations
 Client machines
 The J2EE server machine
 The database or legacy machines at the back end

25. Explain diagrammatically the J2EE Server and Containers?

J2EE Server and Containers

CS T54 - PLATFORM TECHNOLOGY 6


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

26. Where can we apply the best practices throughout the development life cycle?

27. What are the best practices to be carried out in development phase?
 Use proven design patterns
 Automate the build process
 Integrate often
 Optimize communication costs

28. What are the best practices to be carried out in deployment phase?
 Use j2ee standard packaging specification
 Use tools to help in deployment
 Back up your production data and environment

CS T54 - PLATFORM TECHNOLOGY 7


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

29. Distinguish between .Net and J2EE?

30. What is Javax.Servlet.*?


The javax.servlet package contains a number of classes and interfaces that describe and define
the contracts between a servlet class and the runtime environment provided for an instance of
such a class by a conforming servlet container.

CS T54 - PLATFORM TECHNOLOGY 8


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

31. Difference in the development model of J2EE and .NET

32.What is the role of JVM?(APRIL 2012)

J2EE uses a Java Virtual Machine (JVM) built to run Java on each individual platform
UNIX, Windows, Macintosh, etc. .NET uses a common Language Runtime (CLR) virtual
machine that runs on windows machines.

33. What is the use of Javax.Faces.*?

Application represents a per-web-application singleton object where applications based on


JavaServer Faces (or implementations wishing to provide extended functionality) can register
application-wide singletons that provide functionality required by JavaServer Faces.

CS T54 - PLATFORM TECHNOLOGY 9


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

11 Marks

1. WHAT IS J2EE? (Nov 2018)

Java Platform, Enterprise Edition or Java EE is widely used platform for server
programming in the Java language. The Java platform (Enterprise Edition) differs from the
standard Edition Platform (Java SE), is that it adds libraries which provide functionality to deploy
fault tolerance, distributed, multi-tier Java software, based largely on modular components
running on an application Server.
The platform was also known as Java 2 Platform, Enterprise Edition or J2EE until the
name was changed to Java EE in version 5. The current version is called Java EE6.
Features of J2EE:
- Component Based Model

- Container Provided Services

- Highly Scalable

- Simplified Architecture

- Flexible Security Model

J2EE Components & Services:


1. Primary Technologies:
- Servlets
- Java Server Pages (JSP)
- Enterprise Java Beans (EJB)
2. Standard Services & Supporting Technologies:
- Java database connectivity (JDBC) data access API.
- Remote Method Invocations (RMI)
- Extensible Markup Language (XML)
- Java IDL
- Java Mail
2. EXPLAIN THE OVERVIEW OF JAVA 2 ENTERPRISE EDITION ARCHITECTURE

Sun released its J2EE specification which provided a comprehensive view of the Java
middle tier solution. Java solution providers have embraced J2EE.
J2EE uses a 4-level model for web development. The browser runs on the client
displaying HTML and optionally runs JavaScript. The middle tier is comprised of two layers: a
Presentation Layer and a Business Logic Layer. The data manages persistent data in a database.
J2EE implements the Presentation Layer with Servlets and, more recently, Java provides
the option to generate webpages with dynamic content using JavaServer Pages (JSP).
CS T54 - PLATFORM TECHNOLOGY 10
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

Servlets/JSP generates webpages with dynamic content (typically originating from the database).
They also parse webpages submitted from the client and pass them to Enterprise JavaBeans for
handling. Servlets and JSPs run inside a Web Server.
J2EE implements the Business Logic layer with Enterprise JavaBeans (EJB). Enterprise
JavaBeans are responsible for logic like validation and calculations as well as provided data
access (e.g. database I/O) for the application. Enterprise JavaBeans run inside an Application
Sever.
EJBs access a database through one of two means:
•using a JDBC interface which requires a lower level of coding and/or
•using SQLJ which provides a higher level interface to the database
Supporting J2EE APIs
J2EE provides a number of “supporting” APIs. The purpose of most of these APIs is to enable
interaction between the “main” software layers/components in the J2EE architecture.
•Remote Method Interface (RMI)
•Java Naming and Directory Interface (JNDI)
•Java Message Service (JMS)
•Java Transaction API (JTA)
•Java Database Connectivity (JDBC) / SQLJ
•JavaMail /JMC
Remote Method Interface (RMI)
RMI is an important API used for supporting distributed computing and has been supported in
core Java since version 1.1. RMI allows a Java client application to communicate with a Java server
application by invoking methods on that remote object. With RMI, the client gets a reference to a server
object and then it can invoke methods on that object as if it were a local object within the same virtual
machine.
For server objects developed in other languages, you must employ other techniques like using
Java IDL with CORBA or RMI/IIOP to access the server object.
Java Naming and Directory Interface (JNDI)
JNDI allows Java programs to use name servers and directory servers to look up objects or data
by name. This important feature allows a client object to locate a remote server object or data.
JNDI is a generic API that can work with any name or directory servers. Server providers have
been implemented for many common protocols (e.g. NIS, LDAP and NDS) and for CORBA object
registries. Of particular interest to users of J2EE, JNDI is used to locate Enterprise JavaBean (EJB)
components on the network.
Java Message Service (JMS)
JMS is an API for using networked messaging services. Data sent in a message is often intended
as a sort of event notification. Another common use for messaging (thus JMS) is for interfacing with
“external”, third party or legacy applications, typically via a Message Oriented Middleware product like

CS T54 - PLATFORM TECHNOLOGY 11


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

IBM’s MQ Series. It can be complex/risky to use RPC/RMI to directly invoke remote applications while
a messaging solution can provide a simpler and more reliable interconnection.
Java Transaction API (JTA)
JTA is used for managing distributed transactions (e.g. updates to multiple databases that must be
handled in a single transaction). JTA is a low-level API and associated coding is complex and error-
prone.
Fortunately, EJB containers (or application servers) generally provide support for distributed
transactions using JTA. For this reason, the EJB developer is able to gain the benefit of distributed
transaction while leaving the complex implementation details to the provider of the EJB container.
Java Database Connectivity (JDBC) / SQLJ
In principle, JDBC serves the same purpose as ODBC. JDBC provides a database-independent
protocol for accessing relational databases from Java. JDBC supports Data Manipulation Language
(DML) statements like insert, update, delete, select. It also includes Data Definition Language (DDL)
statements like Create Table, Alter Table, etc.
JDBC was included in core Java starting with version 1.1. With JDBC, the SQL is always
dynamically generated at runtime and sent to the database.
A easier-to-use industry standard for Java database access has emerged and is called SQLJ. SQLJ
allows static SQL to be used and it requires less cumbersome syntax than JDBC. Other SQLJ advantages
over JDBC include better code quality and better performance.
3. WHAT IS A TIER?

A tier is an abstract concept that defines a group of technologies that provide one or more
services to its clients. A good way to understand a tier structure’s organization is to draw a parallel to a
typical large corporation.

CS T54 - PLATFORM TECHNOLOGY 12


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

Resources of a large organization are typically organized into a tier structure that operates
similarly to the tier structure used in distributed systems.
At the lowest Level of a corporation are facilities services that consist of resources necessary to
maintain the office building. Facilities services encompass a wide variety of resources that typically
include electricity, ventilation, elevator services, computer networks services, and telephone services.
The next tier in the organization contains support resources such as accounting, supplies,
computer programming, and other resources that support the main activity of the company. Above the
support tier is the production tier. The production tier has the resources necessary to produce products and
services sold by the company. The highest tier is the marketing tier, which consists of resources used to
determine the products and services to sell to customers.
Any resource is considered a client when a resource sends a request for service to a service
provider (also referred to as a service). A service is any resource that receives and fulfills a request from a
client, and that resource itself might have to make requests to other resources to fulfill a client’s request.
Let‘s say that a product manager working at the marketing tier decides the company could make a
profit by selling customers a widget. The product manager requests an accountant to conduct formal cost
analysis of manufacturing a widget. The accountant is on the support tier of the organization. The product
manager is the client and the accountant is the services.
However, the accountant requires information from the manufacturing manager to fulfill the
product manager’s request. The manufacturing manager works on the production tier of the organization.
The accountant is the client to the manufacturing manager who is the service to the accountant.
In multi-tier architecture, each tier contains services that include software objects, database
management systems (DBMS), or connectivity to legacy systems. Information technology departments of
corporation employ multi-tier architecture because it’s a cost-efficient way to build an application that is
flexible, scalable, and responsive to the expectations of client. This is because the functionality of the
application is divided into logical components that are associated with a tier. Each component is a service
that is built and maintained independently of other services. Services are bound together by a
communication protocol that enables a service to receive and send information from to other services.
A client is concerned about sending a request for service and receiving results from a service. A
client isn’t concerned about how a service provides the results. This means that a programmer can quickly
develop a system by creating a client program that formulates requests for services that already exist in
the multi-tier architecture. These services already have the functionality built into them to fulfill the
request made by the client program.
Services can be modified as changes occur in the functionality without affecting the client
program. For example, a client might request the tax owed on a specific order. The request is sent to a
service that the functionality to determine the tax. The business logic for calculating the tax resides within
the service. A programmer can modify the business logic in the service to reflect the latest changes in the
tax code without having to modify the client program. These changes are hidden form the client program.

CS T54 - PLATFORM TECHNOLOGY 13


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

4. DISCUSS ABOUT CLIENTS, RESOURCES AND COMPONENTS.

Multi-tier architecture is composed of clients, resources, components and containers.

A multi-tier architecture consists of clients, resources, components, and containers that are used by
a programmer to create a distributive system.
A client refers to a program that requests service from a component. A resource is anything a
component needs to provide a service, and a component is part of a tier that consists of a collection of
classes or a program that performs a function to provide the service. A container is software that manages
a component and provides a component with system services.
The relationship between a container and a component is sometimes referred to as a contract,
whose terms are governed by an application programming interface (API). An API defines rules a
component must follow and the services a component will receive from the container.
A container handles persistence, resource management security, threading and other system-level
services for components that are associated with the container. Components are responsible for
implementation of business logic. This means programmers can focus on encoding business rules into
components without becoming concerned about low-level system services.
This is an important concept in multi-tier architecture because modification can be made to low-
level security, for example, without requiring any modification to a component. Only the container needs
to be modified by the programmer.
The relationship between a component and a container is very similar to the relationship between a
program and an operating system. The operating system provides low-level system services such as I/O to
a program. Programs don’t need to be modified if a new disk drive is installed in the computer. Instead,
the operating system is recognizing the new disk drive.

CS T54 - PLATFORM TECHNOLOGY 14


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

5. HOW TO ACCESS THE SERVICES?

A client uses a client protocol to access a service that is associated with a particular tier. A protocol is
a standard method of communication that both a client and the tier/component/resources understand.
There are a number of protocols that are used within a multi-tier infrastructure because each
tier/component/resource could use different protocol.
One of the most commonly implemented multi-tier architectures is used in web-centric applications
where browsers are used to interact with corporate online resources. A browser is a client and requests a
service from a web server using HTTP.
In a typical enterprise-wide application, a browser requests services from other components within
infrastructures such as a servlet. A servlet uses a resource protocol to access resources that are necessary
for the servlet to fulfill the request. For example, a servlet will use the JDBC protocol to retrieve data
from DBMS.

6. EXPLAIN J2EE MULTI-TIER ARCHITECTURE IN DETAIL.

J2EE is a four tier architecture.

J2EE Consists of four tiers, each of which focuses on providing specific functionality to an
application.
These consists of the client tier (sometimes referred to as the presentation tier or application tier),
web tier, enterprise information systems tier. Each tier is focused on providing a specific type of
functionality to an application.
It’s important to delineate between physical location and functionality. Two or more tiers can
physically reside on the same java virtual machine (JVM) although each tier provides a different type of
functionality to a J2EE application. And since the J2EE multi-tier architecture is functionality centric, a
J2EE application accesses only tiers whose functionality is required by the application.
It’s also important to disassociate a J2EE API with a particular tier. That is, some APIs (i.e.,
XML API) and J2EE components can be used on more than one tier, while other APIs (i.e., Enterprise
JavaBeans API) are associated with a particular tier.

CS T54 - PLATFORM TECHNOLOGY 15


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

The client tier consists of programs that interact with the user. These programs prompt the user
for input and then convert the user’s response into requests that are forwarded to software on a component
that processes the request and return results to the client program. The component can operate on any tier,
although most requests from clients are processed by components on the web tier. The client program also
translates the server’s response into text and screens that are presented to the user.
The web tier provides internet functionality to a J2EE application. Components that operate on
the web tier use HTTP to receive requests from and send responses to clients that could reside on any tier.
For example, a client’s request for data that is received by a component working on the web tier
is passed by the component to the enterprise JavaBeans tier where an enterprise Java Bean working on the
enterprise JavaBeans working on the enterprise JavaBeans.

A request is typically from one tier to another before the request is fulfilled
Tier interacts with DBMS to fulfill the request. Requests are made to the enterprise JavaBeans by
using the Java remote method invocation (RMI) API. The requested data is then returned by the enterprise
JavaBeans where the data is then forwarded to the web tier and then relayed to the client tier where the
data is presented to the user.
The enterprise JavaBeans tier contains the business logic for J2EE applications. It’s here where
one or more enterprise JavaBeans reside, each encoded with business rules that are called upon indirectly
by clients. The enterprise JavaBeans working on this tier keystone to every J2EE application because
enterprise JavaBeans working on this tier enable multiple instances of an application to concurrently
access business logic and data so as not to impede the performance.
Enterprise JavaBeans are contained on the enterprise JavaBeans server, which is a distributed
object server that works on the enterprise JavaBeans tier and manages transactions and security, and
assures that multithreading and persistence are property implemented whenever an enterprise JavaBeans
is accessed.
Although an enterprise JavaBeans can access components on any tier, typically an enterprise
JavaBeans accesses components and resources such as DBMS on the enterprise information system (EIS)
tier.

CS T54 - PLATFORM TECHNOLOGY 16


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

Access is made using an access control list (ACL) that controls communication between tiers.
The ACL is a critical design element in the J2EE multi-tier architecture because ACL bridges tiers that
are typically located on different virtual local area networks and because ACL adds a security level to
web applications. Hackers typically focus their attack on the web tier to try to directly access DBMS.
ACL prevents direct access to DBMS and similar resources.
The EIS links a J2EE application to resources and legacy systems that are available on the corporate
backbone networks. It’s on the EIS where a J2EE application directly or indirectly interfaces with a
variety of technologies, including DBMS and mainframes that are part of the mission-critical systems that
keep the corporation operational. Components that work on the EIS communicate to resources using
CORBA or Java connectors, referred to as J2EE connector extensions.

7. HOW IS CLIENT TIER IMPLEMENTED?

There are two components on the client tier that are described in the J2EE specification. These are
applet clients and application clients. An applet client is a component used by web client that operates
within the applet container, which is a Java-enabled browser. An applet uses the browser as a user
interface.
An application client is a Java application that operates within the application client container, which
is the Java 2 runtime environment, standard edition (JRE). An application has its own user interface and is
capable of accessing all the tiers in the multi-tier architecture depending how the ACLs are configured,
although typically an application has access to only the web layer.
A rich client is a third type of client, but a rich client is not considered a component of the client tier
because a rich client can be written in a language other than Java-and therefore J2EE doesn’t define a rich
client container.
A rich client is similar to an application client in that both are application that contains their own user
interface. And as with an application client, a rich client can access any tier in the environment,
depending on the ACLs configuration, using HTTP, SOAP, ebXML, or an appropriate protocol.

8. WHAT ARE THE VARIOUS CLASSIFICATIONS OF CLIENTS?

Besides defining clients as an applet client, application client, or a rich client, clients are also
classified by the technology used to access components and resources that are associated with each tier.
There are five classifications: a web client, enterprise JavaBeans client, enterprise information system
(EIS) client, a web service peers, and a multi-tier client.
A web client consists of software, usually a browser that accesses resources located on the web tier.
These resources typically consist of web pages written in HTML or XML. However, a web client can also
access communicate with web tier resources using either HTTP or the hypertext transmission protocol
secured (HTTPS), which is used to transfer encrypted information.

CS T54 - PLATFORM TECHNOLOGY 17


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

Enterprise JavaBeans clients are similar to web clients in that an enterprise JavaBeans client works on
the client tier and interfaces the J2EE application with the user. However, an enterprise JavaBeans client
only accesses one or more enterprise JavaBeans that are located on the enterprise JavaBeans tier rather
than resources on the web tier.
This access is made possible by using the RMI API. RMI handles communication between the
enterprise JavaBeans client and the enterprise JavaBeans tier using either the Java remote method
protocol (JRMP) or the internet inter-ORB protocol (IIOP).
EIS clients are the interface between users and resources located on the EIS tier. These clients use
Java connectors, appropriate APIs, or proprietary protocols to utilize resources such as DBMS and legacy
data sources.
A web services peer is a unique type of client because it’s also a service that works on the web tier.
Technically, a web service peer forms a peer forms a peer-to-peer relationship with other components on
the web tier rather than a true client/server relationship.
However, a web service peer is commonly referred to as a client because it requests service from
other components on the web tier rather, although a web service peer can also access other tiers.
Typically, a web server peer makes requests over HTTP using either electronic business XML or the
simple object access protocol (SOAP).
Multi-tier clients are the conceptually similar to a web service peer except a multi-tier client accesses
components located on tiers other than the tier where the multi-tier client resides. Multi-tier clients
typically use the Java Message service (JMS) to communicate asynchronously with other tiers.

9. EXPLAIN ABOUT WEB TIER ARCHITECTURE.

The web tier has several responsibilities in the J2EE multi-tier architecture, all of which is provided
to the client tier using HTTP. These responsibilities are to act as an intermediary between components
working on the web tier and other tiers and the client tier. Intermediary activities include
 Accepting requests from other software that was sent using POST, GET, and PUT operations,
which are part of HTTP transmissions

 Transmit data such as images and dynamic content

There are two types of components that work on the web tier. These are servlets and Java server
Pages (JSP), although many times they are proxied to the application or EJB tier. A servlet is a java class
that resides on the web tier and is called by a request from a browser client that operates on the client tier.
A servlet is associated with a URL that is mapped by the servlet container.
A request for a servlet contains the servlet’s URL and is transmitted from the client tier to the web
tier using HTTP. The requests generates an instance of the servlet or reuses an existing instance, which
receives any input parameters from the web tier that are necessary for the servlet to perform the service.
Input parameters are sent as part of the request from the client.

CS T54 - PLATFORM TECHNOLOGY 18


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

An instance of a servlet fulfills the request by accessing components/resources on the web tier or on
other tiers as is necessary based on the necessary based on the business logic that is encoded into the
servlet. The servlet typically generates an HTML output stream that is returned to the web server. The
web server then transmits the data to the client. This output stream is a dynamic web page.
JSP is similar to a servlet in that a JSP is associated with a URL and is callable from a client.
However, JSP is different than a servlet in several ways, depending on the container that is used. Some
containers translate the JSP into a servlet the first time the client calls the JSP, which is then compiled and
the compiled servlet loaded into memory. The servlet remains in memory. Subsequent calls by the client
to the JSP and compiling the resulting code. Other containers precompiled a JSP into a. Java file that
looks like a servlet file, which is then compiled into a Java class.
Business logic used by JSP and servlets is contained in one or more enterprise JavaBeans that are
callable from within the JSP and servlet. The code is the same for both JSP and servlet, although the
format of the code differs. JSP uses custom tags to access an enterprise JavaBeans while servlets are able
to directly access enterprise JavaBeans.

10. HOW ENTERPRISE JAVABEANS TIER IS IMPLEMENTED?

J2EE uses distributive object technology to enable JavaBeans developers to build portable, scalable,
and efficient applications that meet the 24-7 durability expected from an enterprise system. The enterprise
JavaBeans tier contains the enterprise JavaBeans server, which is the object server that stores and
manages enterprise JavaBeans.
The enterprise JavaBeans tier is a vital element in the J2EE multi-tier architecture because this tier
provides concurrency, scalability, lifecycle management, and fault tolerance. The enterprise JavaBeans
tier automatically handles concurrency issues that assure multiple clients have simultaneous access to the
same object. The enterprise JavaBeans tier is the tier where some vendors include features that enable
scalability of an application, because the tier is designed to work in a clustered environment. This
assumes that vendor components that are used support clustering. If not, a local director is typically used
for horizontal load balancing.
The enterprise JavaBeans tier manages instances of components. This means components containers
working on the enterprise JavaBeans tier create and destroy instances of components and also move
components in and out of memory.
Fault-tolerance is an important consideration is mission-critical applications. The enterprise
JavaBeans tier is the tier where some vendors include features that provide fault-tolerant operation by
making it possible to have multiple enterprise JavaBeans servers available through the tier. This means
backup enterprise JavaBeans servers can be contacted immediately upon the failure of the primary
enterprise JavaBeans server.
The enterprise JavaBeans server has an enterprise JavaBeans container within which is a collection of
enterprise JavaBeans. As discussed in previous sections of this chapter, an enterprise Java Bean in a class
that contain business logic and is callable from a servlet or JSP.
CS T54 - PLATFORM TECHNOLOGY 19
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

Collectively the enterprise JavaBeans server and enterprise JavaBeans container are responsible for
low-level system services that are required to implement business logic of an enterprise Java Bean. These
system services are
 Resource pooling
 Distributed object protocols
 Thread management
 State management
 Process management
 Object persistence
 Security
 Deploy-time configuration
A key benefit of using the enterprise JavaBeans server and enterprise JavaBeans container
technology is that this technology makes proper use of a programmer’s expertise. That is, a
programmer who specializes in coding business logic isn’t concerned about coding system services.
Likewise, a programming whose specialty is system services can focus on developing system
services and not be concerned with coding business logic.
Any component, regardless of the tier where the component is located, can use enterprise
JavaBeans. This means that an enterprise Java Bean client can reside outside the client tier. The
protocol used to communicate between the enterprise JavaBeans tier and other tiers is dependent on
the protocol used by the other tier.
Components on the client tier and the web tier communicate with the enterprise JavaBeans tier
using the Java RMI API and either IIOP or JRMP. Sometimes software on other tiers, usually the
middle tier, uses JMS to communicate with the enterprise JavaBeans tier. This communication isn’t
exclusively used to send and receive messages between machines. JMS is also used for other
communication, such as decoupling tiers using the queue mechanism.
However, the enterprise Java Bean that is used must be a message-driven bean (MDB). MDBs are
commonly used to process messages on a queue that may or may not reside on the local machine.

11. HOW ENTERPRISE INFORMATION SYSTEM TIER IS IMPLEMENTED?

The enterprise information systems (EIS) tier is the J2EE architecture’s connectivity to resource
that is not part of J2EE. These include a variety of resources such as legacy systems, DBMS, and
systems provided by third parties that are accessible to components in the J2EE infrastructure.
This tier provides flexibility to developers of J2EE applications because developers can leverage
existing systems and resources currently available to the corporation and do not need to replicate
them in J2EE.
Likewise, developers can utilize off-the-shelf software that is commercially available in the
marketplace because the EIS tier provides the connectivity between a J2EE application and non-J2EE

CS T54 - PLATFORM TECHNOLOGY 20


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

software. This connectivity is made possible through the use of CORBA and Java connectors or
through proprietary protocols
Java connector technology enables software developers to create a Java connector for legacy
systems and for third-party software. The connector defines all the elements that are needed to
communicate between the J2EE application and the non-J2EE software. This includes rules for
connecting to each other and rules for conducting secured transactions.
J2EE BEST PRATICES
12. WHAT IS MEANT BY ENTERPRISE APPLICATION STRATEGY?

An enterprise application is a mission-critical system whose continual successful operation


determines the corporation’s success. This means that an enterprise application is complex in nature
and meets the needs of a diverse, constantly changing division of a corporation. The bottom line is
that building an enterprise application is time-consuming, and once the enterprise application is
implemented successfully, few in the corporation want to tinker with a critical application that works
fine.
Corporations face the realities of an enterprise application about three years after the application
becomes operational. The enterprise application starts to age. Corporate needs change to meet new
challenges in the marketplace and so the enterprise application must change. These changes occur
gradually with the creation of a few new reports, and then maybe the addition of new fields and
tables in key database.
These are relatively minor changes, especially when compared to creating a new enterprise
application. However, as the application reaches its five-year anniversary these minor changes begin
taking their toll, mainly because of a philosophy that seems to be prevalent among programmers
whose job it is to maintain legacy applications. These programmers have one and only one objective-
make sure change to the legacy works without negatively affecting the application.
A new strategy
Corporations have taken on a global strategy where business activities and applications that
support those activities are dispersed to business units throughout the world. However, rather than
working independently, these business units transfer knowledge among other business units within
the corporation to give the whole corporation a competitive edge in the global market.
All enterprise application must interface with each other to assure that information can be shared
amongst business units. That is, all application and systems have to work together have the flexibility
built into the architecture so that an enterprise application is incrementally changed to meet new
business demands without having to be reconstructed.
Information technology departments realize that many applications used by business units have
the same functionality. This means that there is duplicate effort within the corporation to maintain
those applications. The new strategy of making enterprise applications interoperable has led to a new
concept used to build enterprise applications.

CS T54 - PLATFORM TECHNOLOGY 21


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

An enterprise application has become a collaborative effort that is divided into two roles-building
functional components and assembling functional components into an enterprise application-which
enables functional components to be, shared amongst many enterprise applications.

13. EXPLAIN WHAT IS AN ENTERPRISE APPLICATION.

The term “enterprise application” is elusive since practically any application used by more than
one person to conduct business could be considered an enterprise application.
It is important that there is a clear understanding of what is meant by the term “enterprise
application” because technique used to design and build an enterprise application may not be the best
way to develop a smaller application. This is because an enterprise application must deal with
performance, security, and other issues that are not found in other kinds of applications.
For the purpose of J2EE, consider an enterprise application to be one that
 Is concurrently used by more than a handful of users

 Uses distributive resources such as DBMS that are shared with other applications

 Delegates responsibility to perform functionality among distributive objects

 Uses web services architecture and J2EE technology to link together components (i.e.,
objects) that are dispersed throughout the corporate infrastructure.

Unlike many smaller applications, an enterprise application is highly visible within a


corporation whose success greatly depends on the application’s successful operations. This results in
corporate users having high expectations from an enterprise application. They want the enterprise
application to
 Be available 24 hours a day, 7 days a week without any downtime

 Have an acceptable response time even in the face of increasing usage

 Have the flexibility to be modified quickly without requiring a redesign of the


application

 Be vendor independent

 Be able to interact with existing systems

 Utilize existing system components (i.e., objects)

This means developers have to create an enterprise application that is available and scalable to
adjust to increases and decreases in demand. The application must be extensible and maintainable so new
business rules can be easily added to the application. In addition, the application must be portable so the

CS T54 - PLATFORM TECHNOLOGY 22


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

company isn’t locked into a specific vendor. Developers also must build in interoperability so the
enterprise application interacts with other applications and is able to reuse existing code.

14. EXPLAIN THE FOLLOWING:

 CLIENTS

 CLIENT PRESENTATION

 CLIENT INPUT VALIDATION

 CLIENT CONTROL

 DUPLICATE CLIENT REQUESTS

CLIENTS:
Software working on the client tier has several functions, many of which are easily developed
by programmers. However, there are a few functions that are less intuitive to program and
therefore pose a challenge to programmers. These functions are to
 Present the application’s user interface to the person who is using the application

 Collect and validate information from the person using the application

 Control the client’s access to resources

 Prevent clients from sending duplicate requests

CLIENT PRESENTATION:
An enterprise application uses a thin client model where nearly all functionality
associated with the application is contained on the server-side rather than with the client. Thin
clients handle the user interface that prevents information to the user and captures input from the
user. There are two strategies for building presentation functionality into a client. These are to use
a browser-based user interface or to create a rich (i.e., applet or application) where a graphical
user interface is programmed into the client. Each has its advantages and disadvantages.
A browser-based user interface is written in either the hypertext markup language
(HTML) or the extensible markup language (XML), which is used by an XML-enabled HTML or
XML code into elements of a user interface.
The browser-based strategy enables easy implementation of the presentation layer of an
enterprise application because details of presentation such as user interface controls and event
handling are built into the browser. Furthermore, browsers provide a standardized user experience
that incorporates elements that are intuitive to use. That is, little or no training is needed for a
person to use a browser-based application.

CS T54 - PLATFORM TECHNOLOGY 23


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

However, the browser-based strategy has disadvantages too. First, the developer doesn’t
have exact control over presentation to the user. Instead, the developer suggests user elements to
the browser, such as front, color, and position of text and images. The browser-based strategy
must test the enterprise application with various browsers and browsers versions to be sure that
the presentation is acceptable.
Another disadvantage of the browser-based strategy is the presentation is limited to
interactions that can be implemented using a markup language or plug-ins, which limits the
design of the user interface. That is, features that cannot be written in a markup language or
provided by a plug-in cannot be implemented in the application.
Still another disadvantages is the presentation layer is server-side dependent. This means
the application accesses the server more than if a richer client strategy was used to create the user
interface. Practically each time an event occurs in a browser-based presentation, the browser must
access the server, which might decrease performance and response time for the user.
A browser-based strategy typically uses the HTTP protocol. HTTP is a stateless protocol,
so the developer must have a strategy for maintaining session state on the server. This situation
can become complex if the system requires failover support. Most “out-of-the –box” technologies
for managing session state do not replicate the session.
In contrast, the richer client strategy gives a developer total control over elements of the
presentation and event trapping. That is, a developer can use WYSIWYG to create the
presentation and isn’t limited to only events that are trapped by the browser.
In addition, a richer client accesses a server only as needed and not in response to nearly
every that occurs in the presentation. This might result in fewer server interactions and increases
response time because there are fewer messages sent to the server.

CLIENT INPUT VALIDATION:


Information that is entered into a client by a user should be validated, depending on the
nature of the information. Details of the validation process are application dependent; however,
the developer has two places where validation can occur: with the client or on the server side.
A developer can implement three kinds of validation strategies Syntax, lexical, and
semantic. Syntactic validation determines if information that consists of several related values is
well formed, such as time that is composed of hours and minute. Lexical validation looks at a
single value to assure that the types of value corresponds to the type of data that is expected by
the application. For example, an hour value must be an integer to pass a lexical validation.
Semantic validation examines the meaning of the information to determine if the information is
likely to be correct. Semantic validation determines if the value of the hour is less than 24 and
greater than or equal to 0.
There are three fundamental factors that must be considered when designing validation
procedures for an enterprise application. These are to avoid duplicating the validation procedure

CS T54 - PLATFORM TECHNOLOGY 24


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

within the application, provide the user with immediate results from the validation process, and
minimize the effect the validation process has on the server.
Duplication of the validation process can become a maintenance nightmare whenever
rules for validation change. Ideally, validation rules should be applied by one object that is called
whenever the validation process is needed. Duplication problems can occur if the validation
process is built into client software because there might instances of the client software.
Users require nearly instantaneous feedback as to the validity of the data whenever they
enter information into a client. Feedback should indicate that the data is valid or invalid. Any
delay providing feedback to the user can lead to a poor user experience with the application.
Syntactic Validation Determines if the information is well informed.
Lexical Validation Determines if the information is the correct
data type.
Semantic Validation Determines if the information is within range.
The Three Validation Strategies that is used in an Enterprise Application Client control
In practically every enterprise application, clients are restricted to resources based on the client
needs. The scope of resources a client can access is commonly referred to as a client view. A
client view might consist of specific database, tables, or rows and columns of table. There are two
ways for a client view to be defined: through embedding logic to define the view into the
application, or by using a controller component that is know as a resources guard.
The resources guard is a component that resides outside of the application that receives request
for resources from all applications. A request for a resource contains a client ID that is compared
to the client’s configuration. Access is either granted or rejected based upon access rights within
the client’s configuration.

CS T54 - PLATFORM TECHNOLOGY 25


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

A resource guard is a component outside the application that manages access to restricted
resources.
Another method that is useful whenever only database access is required is to group
together users who have similar needs into a group profile, then assign permissions to the group.
In this way, the DBMS manages security directly without you having to write your own security
routines.
A resources guard is a component that is shared with other applications. Therefore, the
developer must construct a resource guard using one of the techniques used to share code within
J2EE. Three of the more common ways are to build a resources guard using a Java Server page, a
servlet, or enterprise JavaBeans.
Once the client view is defined, the developer must determine a strategy for
implementing the client view. There are two commonly used strategies: the all-or- nothing
strategy or the selective strategy. The all-or-nothing strategy requires the developer to write logic
that enables or prevents a client from accessing the complete resources. Simply said, the client
can either access all features of a resource or is prohibited from accessing the resources entirely.
In contrast, the selective strategy grants a client access to the resource, but restricts access
to selected features of the resource based on the client’s needs. For example, a client may have
read access to the table that contains orders, but doesn’t have rights to insert a new order or
modify an existing order.
DUPLICATE CLIENT REQUESTS:
A common problem with thin client applications is for the client to inadvertently submit a
duplicate request for service, such as submitting a duplicate order. There are many ways a client
can generate a duplicate request, but they all stem from the same source, which is the browser
user interface.
A browser is the user interface used in a thin client application. However, the browser
contains elements that can lead to a duplicate request being sent. Namely, the back and stop
buttons. The back button causes the browser to recall the previously displayed web page from the
web server. The stop button halts the implementation of a request. This means the browser
processes some, but not all, of the requests.
Normally, the selection of these buttons has minimal consequence to the client because
the browser either displays an unwanted page (previous page) or displays a partial page. In both
cases, the user can easily correct the situation.
However, a problem might occur if the client is sending a web from such as an order
from to the web tier. Let’s say that the user submits the order form. The application generates a
confirmation web page that the browser displays. The user then inadvertently selects the
browser’s back button, which redisplays the order from. This might be confusing and cause the
user to resubmit the order form, thinking that a snafu occurred. In reality, two orders are
submitted.

CS T54 - PLATFORM TECHNOLOGY 26


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

Let’s say the beginning of the JSP updates the session state to indicate the form was
submitted and processed, but the server terminates the JSP before it completes. This can happen
when the user hits the stop button or the esc key, causing the process on the server to be
terminated. The session state object may not be updated. Explicitly updating the session object
without waiting for the page to complete alleviates potential problems

Flush the previous session as the first action the program takes when a new form is
submitted. This avoids duplicate sessions from occurring.

15. WHAT IS MEANT BY SESSIONS MANAGEMENT?

A web service-based enterprise application consists of distributive services (i.e.,


components) located on J2EE tiers that are shared amongst applications. A client accesses
components by opening a session with the web tier. The session begins with an initial request for
service and ends once the client no longer requests services.
During the session, a client and components exchange information, which is called
session state. Practically any kind of information can be a session state, including a client’s, a
client’s profile, or choices a client makes in a web form.
A components is an entity whose sole purpose is the receive information from a client,
process that information, and return information to the client when necessary. Information used
by a component is retained until the request from the client is fulfilled. Afterwards, information is
destroyed. A component lacks persistence. Persistence is the inherent capability of retaining
information (session state) between requests.

CS T54 - PLATFORM TECHNOLOGY 27


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

This means that it up to the enterprise application to devise a way to maintain session
state until the session is completed. There are two common ways to manage session state: on the
client side or server side on the enterprise JavaBeans tier.

16. WHAT IS MEANT BY CLIENT-SIDE SESSION STATE?

Session state can be maintained by the client rather than on the server using one or a
combination of three techniques. These are by using a hidden field in an HTML form, by
rewriting URLs, and by using cookies.
An enterprise application typically uses an HTML form to collect information from a
user. An HTML form can contain many elements. The more commonly used elements are text,
fields, and buttons. Text consists of characters that appear on the form such as the title of the
form and instructions for completing the form.
A field is the place on the form where the user enters data. Each field has a field name
that uniquely identifies the field and a value. There a re several kinds of fields, including drop-
down combo boxes that list valid entries, radio buttons, check boxes, and free-form text fields. A
button is an image selected by the user to submit or clear the form
<INPUT TYPE=”TEXT” NAME=”FIRSTNAME” SIZE=”40>
<INPUT TYPE=”SUBMIT” NAME=”SUBMIT”>
<INPUT TYPE=”RESET” NAME=”CLEAR”>
When the user selects the submit button, the browser extracts the field names and field
value from the form and assembles them into a query string. The browser then calls a component
on the web tier, which is usually a JSP program or servlet, and passes field names and field
values as parameters to the component. The component then processes this information. Once
processing is completed, the component dynamically generates a web page that may contain
another form, depending on the nature of the application.
www.mysite.com/jsp/myjsp.jsp?FRISTNAME=Jimkeogh

Hidden field
The component can include in the HTML form a field that isn’t displayed on the form.
This field is called a hidden field. A hidden field is similar to other fields on the form in that a
hidden field can hold a value. However, this value is assigned to the hidden field by the
component rather than by the user.
A hidden field is treated the same as other fields on the form when a user selects the
submit button. That is, the name of the hidden field and the value of the hidden field are extracted
from the form along with the other fields by the browser and sent as a parameter to the
components. This means that session state can be retained by assigning the session state as a
value to one or more hidden fields on each form that is used during the session.
<INPUT TYPE=”HIDDEN” NAME=”Account Number” VALUE=”1234”>
CS T54 - PLATFORM TECHNOLOGY 28
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

<INPUT TYPE=”TEXT” NAME=”FRISTNAME” SIZE=”40”>


<INPUT TYPE=”SUBMIT” VALUE=”SUBMIT”>
<INPUT TYPE=”RESET” VALUE=”CLEAR”>
The best practice for using a hidden field to maintain session state is to do so only when
amounts of string information need to be retained. Although using a hidden field is easy to
implement, it can cause performance issues if large amounts session of state are required by the
application. This is because the session state must be included with each page sent to the browser
during the session regardless if the session state plays an active role on the page.
URL rewriting
The best practice is to use URL rewriting to retain session state whenever an HTML form
is not used by the client. For example, the user might place an order using an HTML form. The
order contains the user’s account number along with other information.
Cookies
The best practice is to use a cookie only to retain minimum data such as a client ID and
use other techniques described in this section to retain large amounts of information. A developer
must also implement a contingency routine should the user discard the cookie or deactivate the
cookie feature.

17. WHAT IS MEANT BY SERVER-SIDE SESSION STATE?

An alternative to maintaining session state on the client side is to store session state on
the server. Typically, the information technology department of a corporation goes to extremes to
assure that the server and backup servers are available 24 hours a day, 7 days a week, which is
not the treatment given to client machines.
Using the Http Session Interface
The best practice is to maintain session state on the Enterprise JavaBeans Tier using an
Enterprise or on the web tier using the Http session interface. Each session state is assigned a
session ID, which relates the session state with a particular client session. The session ID is used
whenever the session state is written to or retrieved from the server.
Replication servers
It is not uncommon for an enterprise application to use a cluster of replication servers
where each server has the full complement of components. Whenever a request is received from a
client, the request is routed to the next available server within the cluster. In this way, the
infrastructure can maintain acceptable performance even if hundreds of requests are received
simultaneously.
Maintaining a sticky user experience
The best practice is to maintain a sticky user experience, depending on your business
needs. This means the client always uses the same server during the session and the session state

CS T54 - PLATFORM TECHNOLOGY 29


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

is stored on one server within the cluster. This also means that the session is lost should the server
go down.
Valid session state
The best practice is to always set a session timeout, which automatically invalidates
session state after time has passed and the session state has not been accessed. The actual length
of time before the session automatically terminates will vary depending on the nature of the
application. However, once time has expired, the session ends-and therefore the session state are
removed.

18. WHAT IS MEANT BY WEB TIER AND JAVA SERVER PAGES?

The web tier contains components that directly communicate with clients. The web tier is also
the location where Java Server Pages (JSP) programs reside. JSPs are commonly proxy server plug-
ins in their implementation.
This is a particularly good technique to use when vertically scaling your application because it
provides additional security. All executable processing resides below the web server and out of reach
of an attack, which is usually focused on web servers. A JSP program is a component that provides
service to a client. The nature of the service depends on the design of the application.
A JSP program is identified with a URL that is associated with a hyperlink built into a web
page displayed on the client. When a user selects the hyperlink, the browser calls the JSP program,
which executes JSP statements.
Presentation and processing
A JSP program can contain two components: the presentation component and the processing
logic. The presentation component defines the content that is displayed by the client. Processing
logic defines the business rules that are applied whenever the client calls the JSP program
The best practice for writing a JSP program is to separate the presentation code and the
processing code (see figure 3-4). Place the presentation code in the JSP program and place the
processing code in enterprise JavaBeans. Have the JSP program call the enterprise JavaBeans
whenever the JSP program is required to process information. An alternative best practice is to
simply include files that contain code to hide the code from the graphic artist.

CS T54 - PLATFORM TECHNOLOGY 30


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

A JSP Program is used to create the presentation for an enterprise application while
Enterprise JavaBeans used to process information.

19. DISCUSS ABOUT INCLUSION STRATEGY

Using the Inclusion Strategy


The best practice to avoid redundant code is to use the inclusion strategy, which uses either the
include directive or include action to insert commonly used code into a JSP program. The JSP
program include directive is used within the JSP program to specify the file whose content must
be included in the JSP program. This file should contain shared code such as HTML statements
that define common elements of web pages. The include action calls a JSP program within
another JSP program. Commonly used code is contained in the called JSP program.
Using the Include directive
The best practice is to use the include directive whenever variables are used in the JSP
program. The include directive places the variable name in the calling JSP program and lets the
calling JSP program resolve the variable. In contrast, the include action places the value of the
variable in the calling JSP program.
Style sheets
The best practice to enforce continuity among web pages that comprise an application’s user
interface is to use cascading style sheet (CSS). CSS is a file describes the style of elements that
appear on the web page.
Simplify Error Handling
Handling errors

CS T54 - PLATFORM TECHNOLOGY 31


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

A best practice for handling errors is to generate a user-friendly error message that reflects the
processing that was executing when the error occurred, session state (where applicable), and the
nature of the error.
Saving Error Messages
Another best practice when handling errors is to have either the JSP program or the enterprise
JavaBeans save all error messages and related information (i.e., session state) to an error file, then
notify technical support that an error was detected.

20. EXPLAIN THE BEST STRATEGY TO BE USED IN ENTERPRISE JAVABEANS TIER

The enterprise JavaBeans Tier contains Enterprise JavaBeans that provide processing logic to
other tiers. Processing logic includes all code and data that is necessary to implement one or more
business rules.
As discussed, the purpose of creating an enterprise JavaBeans is to encapsulate code that
performs one task very well and to make that code available to any application that needs that
functionality.
Although the concept of using enterprise JavaBeans is easily understood, there can be
confusion when designing enterprise JavaBeans into an application’s specification. Simply stated,
the developer must determine what functionality should be built into an enterprise JavaBeans.
Making JavaBeans self-contained
The best practices are making each enterprise JavaBeans self-contained and minimize the
interdependence of enterprise JavaBeans where possible. That is, avoid having a trail of
enterprise JavaBeans calling each other. Instead, design an individual enterprise JavaBeans to
complete a specific task.
Entity to enterprise JavaBeans Relationship
The best practice when translating an entity relationship diagram into enterprise JavaBeans is
to consolidate related processes that are associated with several entities into one session
enterprise JavaBeans. This results in the creation of fewer enterprise JavaBeans while still
maintaining the functionality required by the application.
Efficient Data Exchange
The best practice when exchanging information between a JSP program and enterprise
JavaBeans is to use a value object. In this way, there is less stress on the network than sending
individual data and the value objects retain the associated among data elements.
Enterprise JavaBeans Performance
Placing components in communication
The best practice is to keep remote communication to the minimum needed to exchange
information and to minimize the duration and any communication. A common way to accomplish

CS T54 - PLATFORM TECHNOLOGY 32


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

this objective is by placing components that frequently communicate with each other on the same
server, where possible.
Consider Purchasing Enterprise JavaBeans
Surveying the marketplace
The best practice is to survey the marketplace for third-party enterprise JavaBeans that meet
some or all of the functionality that is required by an entity enterprise JavaBeans or session
enterprise JavaBeans for an enterprise application. The sun Microsystems, Inc. web site offers
third-party enterprise JavaBeans in their solutions Marketplace.
The Model-View-Controller (MVC)
Using the Model-view-controller
The best practice for simplifying the distribution of an application’s functionality is to use the
Model-View-Controller (MVC) strategy that is endorsed by Sun Microsystems, Inc. and which
has its roots in the decades-old technology of Smalltalk

The MVC strategy divides an application into a model class, a view class, and a controller
class, which coordinates activities between the two other classes.

21. COMPARISON BETWEEN J2EE AND .NET (Nov 2018)

J2EE and Microsoft .NET aim to simplify the development of web applications by
providing a set of standardized, modular components and services.
A key difference between Java and .NET is that J2EE is an open standard that runs on
multiple platforms, while .NET is Microsoft proprietary and runs only on Windows. J2EE
products are available from numerous vendors, while .NET Technology is available only from
Microsoft. It is important to note that J2EE is not a product, rather a standard to which products
are written.

CS T54 - PLATFORM TECHNOLOGY 33


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

Another difference between J2EE and .NET is that J2EE is written in a single language,
java, while .NET supports multiple language – the chief ones being Microsoft’s visual
basic .NET, C#, C++ .NET. Other languages can be supported by .NET if they are rewritten to
run in the .NET environment.
J2EE and .NET each provides libraries of components. The J2EE component library
comprises the java core API, which includes Enterprise Java Beans. .Net provides class libraries
that contain .NET managed Components. .NET also utilizes the previous generation of COM+
serviced components in the Windows Operating System.
In the J2EE model, particular operations of each tier takes place in separate “containers”.
A container is a piece of the runtime that handles tasks in a consistent manner-such as retrieving
data and creating a web page. .NET does not have containers, rather than there are multiple ways
in which operations can be coded or handled.
In the .Net Framework, “Managed code” is all code that is executed by the .NET
Common Language Runtime. Managed code also can access and interoperate with unmanaged
code.
J2EE and .NET each have a set of components, services, and features that provide a
standard way of performing tasks such as accessing databases, scripting Web pages, handling
messages, and connecting to remote resources. A comparison of the key J2EE and .NET features
and services are summarized in the table below.

SERVICE OR FEATURE MICROSOFT .NET J2EE


Language C#, VB.NET, C++.NET other Java
modified languages.
Operating System Windows Multiple
Runtime CLR JVM
Server Components .NET, COM+ serviced EJBs
Client/GUI Components .NET CLASS JAVA BEANS
Web Server Pages ASP.NET JSP/SERVLET
Data Access ADO.NET JDBC
Persistent Objects Business Entity Components EJB Entity Beans
Message Queuing Sys.Messaging, MSMQ JMS on (MQ series , etc)
Asynchronous Invocation COM+ ,QC EJB Message Beans
Remoting SOAP, HTTP, DCOM RMI – over – IIOP
Naming ADSI JNDI
XML System XML JAXP
HTTP Engine IIS Application Servers from
multiple vendors.

CS T54 - PLATFORM TECHNOLOGY 34


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

Web Services Support Built – In Add - on

J2EE and .NET are each based on a virtual machine runtime that exist above on operating
system. J2EE uses a Java Virtual Machine (JVM) built to run Java on each individual platform
UNIX, Windows, Macintosh, etc. .NET uses a common Language Runtime (CLR) virtual
machine that runs on windows machines. To support multiple languages, the .NET CLR contains
an Intermediate Language (IL) engine. Code and objects written in a language can be complied
into the IL runtime, once an IL compiler is developed for the language.

CS T54 - PLATFORM TECHNOLOGY 35


SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE Dept of CSE

PONDICHERRY UNIVERSITY QUESTIONS

2 MARKS
1. Why J2EE?(NOV 2013) (Ref.Qn.No.3, Pg.no.2)
2. What is the relationship between container and component?(NOV 2013)
(Ref.Qn.No.7&9, Pg.no.3&4)
3. What is the role of JVM? (APRIL 2012) (Ref.Qn.No.32, Pg.no.9)
4. Write down the importance of Threads. (APRIL 2012)
5. What is the use of Javax.Faces.*?(NOV 2012) (Ref.Qn.No.33, Pg.no.9)
6. What is Javax.Servlet.*?(NOV 2012) (Ref.Qn.No.30, Pg.no.8)
7. Justify the statement “Java is a Platform Independent Language”. (APRIL 2013)
8. Write the components of MVC. (APRIL 2013) (NOV 2015) (Ref.Qn.No.20,
Pg.no.33)
9. What is enterprise edition? (APRIL 2015)
10. State any two best practices in J2EE. (APRIL 2015)
11. Differentiate between applet client and Application client. (NOV 2014)
(Ref.Qn.No.15, Pg.no.4)
12. What is a tier? (NOVEMBER 2014) (Ref.Qn.No.3, Pg.no.12)
13. List out the type of object classes. (APRIL 2014)
14. What is a container? (APRIL 2014) (Ref.Qn.No.9, Pg.no.4)
15. What is Delegates? (NOVEMBER 2015)

11 MARKS
1. a) What are the five classifications of clients? Explain.(NOV 2013)(Ref.Qn.No.8,
Pg.no.17)
b) Write down the services provided by EJB.
2. Compare the features of J2EE and .NET. (NOV2013) (APRIL 2015)(Ref.Qn.No.21,
Pg.no.33)
3. a) Explain the classification of Clients in J2EE. (APRIL 2012)(Ref.Qn.No.8,
Pg.no.17)
b) Explain briefly about Client Input Validation.
4. Discuss about Multi-Tier Architecture in detail. (APRIL 2012) (APRIL 2015)
(Ref.Qn.No.6, Pg.no.15)
5. Briefly explain Multi-Tier Architecture in J2EE. (NOV 2012, 2014)(Ref.Qn.No.6,
Pg.no.15)
6. Explain Comparison between J2EE and .NET.(NOV 2012, 2015)(Ref.Qn.No.21,
Pg.no.33)
7. Explain about the advantages of Java Programming. (APRIL 2013)
8. Discuss about the Sessions Management in detail. (APRIL 2013)
9. Discuss about the usage of web tier and JSP. (NOV 2014)(Ref.Qn.No.9, Pg.no.18)
10. Explain in detail about various components in J2EE Architecture. (APRIL 2014)
(Ref.Qn.No.2, Pg.no.10)
11. Using J2EE components create a dynamic web application for listing a product
catalogue and place order of multiple items in the cart. (APRIL 2014)
12. Explain clearly the use of interfaces in java. (NOV 2015)

CS T54 - PLATFORM TECHNOLOGY 36

You might also like