You are on page 1of 46

Introduction to Web

Application
Introduction to Java
• Platform-independent programming language
• Used to create
• robust and secure applications, which can run on
• single computer or can be distributed among servers and clients
• 4 aspects of Java
• Java Programming Language (JDK)
• Java Runtime Environment (JRE)
• Java Virtual Machine (JVM)
• Java Platform
Java Programming Language
• An object oriented language
• Syntax is similar to C, C++
• Fulfills following primary goals of object oriented language:
• Uses the object-oriented methodology
• Allows the same program to be executed on multiple operating systems
• Contains built in support for using computer networks
• Executes code securely from remote sources
• It is widely used standard in enterprise programming
Java Runtime Environment (JRE)
• Also known as Java Runtime
• Part of Java Development Kit (JDK)
• JDK is a set of programming tools required for developing Java apps
• JRE consists of-
• Java libraries
• Java Virtual Machine
• Other components essential for running java applications
The Java Platform
• Over the years, the Java platform evolved into three major editions, each
addressing a distinct set of programming needs:
• The Java Platform, Standard Edition (Java SE)
• Most commonly used among the three editions
• Used for developing desktop and console-based applications
• It consists of:
• A runtime environment
• Set of APIs, to build a wide variety of applications comprising standalone applications that can run
on various platforms- Windows, Linux, Solaris
• The Java Platform, Enterprise Edition (Java EE)
• Used for building server-side applications, by using its component-based approach
• The Java Platform, Micro Edition (Java ME)
• Used for computing micro devices- handheld devices- PDAs, mobile phones – with limited
display and memory support
Enterprise Architecture
• Enterprise architecture
• EJB,Servlet,JSP,XML
• Helps in understanding the structure of an enterprise application
• It can be broken down into three fundamental logical layers:
• User interface layer
• Displays data elements to the users and collecting data from the users
• Often called the ‘presentation’ layer- it includes the part of the software that creates and
controls the user interface and validates the user’s actions
• Processing layer
• Helps an application to work and handle processing of business logic
• Also called the ‘business layer’
• Data storage & access
• Helps the processing layer to read and store data
Enterprise Architecture Types
• An enterprise application can be designed in many ways,
• but, here we discuss the following types of enterprise architectures:

• Single-tier architecture
• 2-tier architecture
• 3-tier architecture
• n-tier architecture
Single-tier Architecture
• It consists of
• the presentation, the business rules, and the data access layers
• in a single computing layer.
• Such applications are
• relatively easy to manage,
• and implement data consistency, since data is stored in a single location
• Problem-
• Such applications can’t be scaled up to handle
• multiple users, and
• they do not provide an easy means of sharing data across enterprise
2-tier Architecture
• It separates the data and business logic.
• the application resides entirely on the local machine, and
• the database is deployed at a specific and secured location.
• In 2-tier application (a. k. a. client-server application),
• the processing load is entrusted with the client,
• while the server simply controls the traffic between the application and data
1st Layer Data Layer

Data Access
Presentation Logic Business Logic
Layer Database
2-tier Architecture
3-tier Architecture
• In 3-tier architecture, an application is virtually split into three
separate logical layers
3-tier Architecture
• Layers:
• First tier: ‘presentation layer’- consists of a GUI to interact with the user
• Middle tier: ‘business layer’- consists of the application (or business) logic;
• Third tier: ‘data layer’ – contains data access logic needed for the application.
• This separation of application logic from the user interface adds
enormous flexibility, as compared to the 2-tier system, to the design
of an application.
• By using this architecture, multiple user interfaces can be built and deployed
without changing the application logic; provided it defines a clear interface to
the presentation layer.
2-tier vs. 3-tier
n-tier Architecture
• There can be numerous layers in this kind of architectures.
• In this model,
• The user interface logic is retrieved from the application running on the
desktop.
• The application on the desktop is responsible for presenting the user interface
to the end user and for communicating to the business logic tier.
• It is no longer responsible for enforcing business rules or accessing databases.
• There is no hard & fast way to define an application in this architecture.
• In fact, n-tier architecture can support a number of different configurations.
n-tier Architecture
• It can be virtually distributed in to the following segments:
n-tier Architecture
• Advantages
• Improved maintainability
• Such applications are easier to maintain
• Consistency
• By means of component designing and their association with the layer in the
architecture where they are providing functionality
• Interoperability
• Such applications are highly interoperable, as we can implement components in different
layers to support different technologies and platforms
• Flexibility
• Developer is free to design and develop various types of components for different layers
with all flexibility
• Scalability
• We can add new components without affecting the performance of the existing
application
Applications Development Requirement
• Platform independence - Do not get caught in complexity of operating systems
• Develop Once, run every
• Strong framework, ensure repeatability – Ensure building blocks
• Flexibility in individual implementation over common rules
• Internationalization requirements
• Access of business rules including data and methods
• Reduced dependency on database
• Organization component modelling
• Standardization with Business entities
• Technology Portability
• Ability to change business rules easily
Exploring the Java EE5 platfom
• It comprises of the following:
• A runtime infrastructure for managing and hosting applications. All runtime
applications are hosted in this server.
• A set of Java APIs to build applications. These Java APIs describe the
programming model for Java EE appliations.
The Java EE APIs
• In the enterprise services, the distributed applications require server
access for running.
• These enterprise services include transaction processing, managing,
multithreading, and database access.
• J2EE5 unifies access to such services in its enterprise service APIs.
• The j2ee5 application program can access these APIs through the
containers such as Web and EJB,
EJB 3.0
• An enterprise bean is a server-side piece of code with fields and
methods to implement the modules of the business logic.
• It is a building block that can be used alone or with other enterprise
beans to execute the business logic on the Java EE server
• It is a component based architecture for developing, deploying, and
managing reliable enterprise applications
Java Servlet Technology
• It allows you to define HTTP-specific servlet-classes.
• A servlet class extends the capabilities of servers that host the
applications accessed by the way of request-response programming
model.
Java Server Pages & JSP Tag Library(JSTL)
• It allows you to integrate the combined snippets of Java code with
static markup in a text-based document.
• It is a text-based document that contains two types of text:
• Static template data, which can be expressed in any text-based format such as
HTML or XML
• JSP elements, which determine how the page constructs the dynamic content
• JSTL provides a set of standard tags that can be used in a JSP page
• It provides tags to use java code embedded in a JSP page
• It includes various tags to control the flow of execution, to support
internationalization and to access database using SQL
Java Server Faces
• Provides component based API for building rich user interfaces for
web applications.
• Used in conjunction with JSP and servlets
• They handle all the complexities of managing the UI, enabling the
developer to concentrate on the business logic.
Java Message Service (JMS)
• The JMS API is a messaging standard that allows Java EE application
components to create, send, receive, and read messages.
• It enables distributed communication that is loosely coupled, reliable,
and asynchronous.
Java Transaction API(JTA)
• JTA is used to manage distributed transactions.
• This API specifies a standard java interface for a transaction manager
to interact with the resource manager, application server, and
transactional appliacations.
JavaMail API
• Many enterprise applications need to send email notifications.
• Java EE platform includes the JavaMail API with a JavaMail Service
provider that application components can use to send emails.
• It has two parts:
• An application-level interface used by the application components to send
emails
• A service provider interface
JavaBeans Activation Framework (JAF)
• it provides the standard services –
• to determine the type of an arbitrary
• to encapsulate access to it
• to identify the operations available on it, and
• to instantiate appropriate JavaBean components to perform these operations
Java API for XML Processing (JAXP)
• it enables applications to parse, transform, validate, and query XML
documents
• This API is independent of XML processor implementation
Java API for XML Web Services(JAX-WS)
• The JAX-WS specification helps
• create web service endpoints and client components to access the web
services.
• It also describes the deployment information of web services and
clients.
• It also supports JAXB
• JAXB API is used to bind XML data to java objects.
Java Architecture for XML Binding(JAXB)
• It helps on binding an XML schema with a java object in a simple and
easy way.
• It helps in marshalling java content tree into XML instance
documents, and vice versa.
JDBC API
• The Java DataBase Connectivity API helps execute SQL commands
from Java programs.
• JDBC API can be used with
• Enterprise java beans,
• JSP,
• Servlets, and
• Java classes
Java Persistence API (JPA)
• In Java EE, a solution for persistence has been provided in the form of
JPA.
• An object relational mapping, which is used by persistence, is used for
bringing an OO model and relational database model together.
• JPA consist of
• the Persistence API,
• query language, and
• object/relational mapping metadata.
Java Naming and Directory Interface (JNDI)
• It provides the naming and directory functionality.
• It provides Java EE applications with the methods to perform standard
directory operations, such as
• associating attributes with the objects and searching for the objects by using
their attributes.
• Using JNDI, a Java EE application can store and retrieve any type of
named Java objects.
Java Authentication and Authorization Service
(JAAS)
• JAAS provides a way for a Java EE application to authenticate and
authorize a specific user or group of users.
• JAAS is a Java based standard Pluggable Authentication Module (PAM)
framework,
• which extends the Java platform security architecture to support user-based
authorization.
J2EE Suite (summary)
• Core technology: Container infrastructure, language and environment support
• XML technology
• The Java API for XML Processing (JAXP)
• The Java API for XML-based RPC (JAX-RPC)
• SOAP with Attachments API for Java (SAAJ)
• The Java API for XML Registries (JAXR)
• Web Technology
• Java Servlets
• JavaServer Pages
• JavaServer Pages Standard Tag Library
• Enterprise Java Bean (EJB) technology
• Session beans
• Entity beans
• Enterprise JavaBeans Query Language
• Message-driven beans
• Platform services
• Security
• Transactions
• Resources
• Connectors
• Java Message Service
Distributed Multi-tiered Applications
• Services, clients (people and application) and data are distributed
geographically across many platforms and many machines.
• Multiple tiers:
• Client-tier (browser or client-application)
• Web-tier (web-server: Java Server Pages)
• Business-tier (logic; Examples: Enterprise Java Beans)
• Enterprise-Information-System (EIS) tier (database)
Java 2 Enterprise Edition (J2EE)
Example

J2EE server

Web Container
HTTP Request
Servlet
HTTP Response

Client
(Browser)
Bean1 Bean2

EJB Container Database


Containers
• Containers are a central theme in J2EE architecture.
• Containers are like the rooms in the house-
• People and things exist in the rooms, and interface with the infrastructure
through well-defined interfaces.
• In an application server,
• Web and business components exist inside the containers and interface with the Java EE
infrastructure through well-defined interfaces.
J2EE Containers
• What is a Container
• Containers are the interface between a component and the
low-level platform specific functionality that supports the
component.
• How does it work
• Container settings are specified for each component during
assembly process before deployment.
• What do I get
• Support for security, transaction management, JNDI lookup,
Remote connectivity.
J2EE Containers (cont..)
– Manage life cycle of
objects
– Manage transactions
– Provide security
– Resource optimization
•DB pooling
•Compiled JSP Caching
– Persistence support
•CMP (EJB-QL)
Types of Containers
• EJB Container
• Web Container
• Application Client Container
• Applet Container
Compilation and Deployment
• Compilation (building the executables) uses build tool such as Apache
Ant.
• The components of the various tiers are packaged: .jar, .war, .ear
• Declarative resources are added.
• A deploy tool or management tool is used to deploy the packaged
units into a J2EE server (container).
HTTP REQUEST METHODS
• GET
• POST
• HEAD
• PUT
• DELETE
• OPTIONS
• TRACE
Thank You

You might also like