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

PPT Unit 3 J2EE and Web Development-265689

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

PPT Unit 3 J2EE and Web Development-265689

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Prepared By

Prof. Tarannum Bloch


Assistant Professor, IT Dept.
Past History

Initially two tier architecture (client server applications)

Around since the mid-80s.

Client power.

RAD development (VB, Developer/2000, PowerBuilder).

Client is responsible for data access applying business logic and


presentation of data

Only service provided by Server was that of database server.


Two-tier Software
Architecture
Two-tier Software
Architecture

Drawbacks

• Easy to deploy but difficult to enhance or


upgrade.

• Difficult to reuse business and presentation


logic

• Not scalable and not suited for internet


Three-tier Software
Architecture
N-Tier

More server oriented.

Application can be divided to tiers, each responsible for different


aspect of the application:

Easier upgrading

Easier support

But:
Our requirements have increased
Where is our RAD?
Modern Application
Needs

• All we were used to:


- Functionality
- User interface
- Rapid Application Development

• And something more:


- Security
- Performance
- Management
- Upgrade-ability
- Integration
J2EE Introduction
Java 2 Platform Enterprise Edition (J2EE) is an architecture for
implementing enterprise class applications using Java and Internet
Technology

Solves problems of two tier architecture

And provides support to develop n tier application. It supports the


development of a variety of application types

-small client server systems


-Systems running on Intranets
-Systems on large scale internet e-commerce site
J2EE Introduction

J2EE is a set of specifications, which define the standard for developing multi-
tier enterprise applications with Java. The J2EE platform provides a complete
framework for design, development, assembly, and deployment of Java
applications built on multi-tiered distributed application model.

J2EE Features:-
Component based model
Container provided services
Highly Scalable
Simplified Architecture
Flexible security model
J2EE Components
J2EE application components

• Client : applets, Javabeans.


• Presentation logic tier: servlets, Java server pages, Javabeans.
• Business logic tier: Enterprise Javabeans. ( EJB )
• Data tier

JavaBeans are classes that encapsulate many objects into a single object (the
bean). They are serializable, have a zero-argument constructor, and allow access
to properties using getter and setter methods. The name "Bean" was given to
encompass this standard, which aims to create reusable software components
for Java.

Enterprise JavaBeans (EJB) is one of several Java APIs for modular construction
of enterprise software. EJB is a server-side software component that
encapsulates business logic of an application. An EJB web container provides a
runtime environment for web related software components
J2EE architecture
J2EE Containers

• What is container ?
Containers are the interface between a component and the low-level platform-
specific functionality that supports the component. Before a web component,
enterprise bean, or application client component can be executed, it must be
assembled into a J2EE module and deployed into its container.

Containers provide services for :


• Security
• Transaction
• Persistence
• Concurrency
• Availability
• Lifecycle Management
Java EE Containers

• Normally, thin-client Multi-tiered applications are hard to write


because they involve many lines of intricate code to handle
▪ transaction and state management
▪ multithreading
▪ resource pooling
▪ other complex low-level details.

• The component-based and platform-independent Java EE


architecture makes applications easy to write because business
logic is organized into reusable components.
• In addition, the Java EE server provides underlying services in the
form of a container for every component type.
• Because you do not have to develop these services yourself, you are
free to concentrate on solving the business problem at hand.
J2EE Containers

The runtime portion of a J2EE product. A J2EE server provides EJB and
web containers.
• Enterprise JavaBeans (EJB) container
Manages the execution of enterprise beans for J2EE applications. Enterprise beans and
their container run on the J2EE server.
• Web container
Manages the execution of JSP page and servlet components for J2EE applications. web
components and their container run on the J2EE server.
• Application client container
Manages the execution of application client components. Application clients and their
container run on the client.
• Applet container
Manages the execution of applets. Consists of a web browser and Java Plug-in running on
the client together.
Web container
Apache Tomcat (formerly Jakarta Tomcat) is an open source web container
available under the Apache Software License.
Apache Geronimo is a full Java EE 6 implementation by Apache Software
Foundation.
Enhydra, from Lutris Technologies.
GlassFish from Oracle (an application server, but includes a web container).
Jetty, from the Eclipse Foundation.
Jaminid contains a higher abstraction than servlets.
Payara is another application server, derived from Glassfish.
Winstone supports specification v2.5 as of 0.9, has a focus on minimal
configuration and the ability to strip the container down to only what you need.
Tiny Java Web Server (TJWS) 2.5 , small footprint, modular design.
Virgo from Eclipse Foundation provides modular, OSGi based web containers
implemented using embedded Tomcat and Jetty. Virgo is available under the
Eclipse Public License.
WildFly (formerly JBoss Application Server) is a full Java EE implementation by
Red Hat, division JBoss.
Applications Servers

An application server is a software framework that provides both facilities to create


web applications and a server environment to run them.

Application Server Frameworks contain a comprehensive service layer model. An


application server acts as a set of components accessible to the software developer
through a standard API defined for the platform itself.

For Web applications, these components are usually performed in the same
running environment as their web server(s), and their main job is to support the
construction of dynamic pages. However, many application servers target much
more than just Web page generation: they implement services like clustering, fail-
over, and load-balancing, so developers can focus on implementing the business
logic.
Types of Servers in J2EE
Applications
So now we have established what an Application server is, we will now take a look
at the available Java Application Servers.

Glassfish. ...
JBoss Enterprise Application Platform. ...
Wildfly. ...
Apache Tomcat. ...
Apache TomEE. ...
JOnAS. ...
Resin Servlet Container (Open Source) ...
Blazix.
Hypertext Transfer Protocol

One of the most commonly used services on the Internet is the World Wide Web
(WWW). The application protocol that makes the web work is Hypertext
Transfer Protocol or HTTP.

Do not confuse this with the Hypertext Markup Language (HTML). HTML is the
language used to write web pages. HTTP is the protocol that web browsers and
web servers use to communicate with each other over the Internet.

It is an application level protocol because it sits on top of the TCP layer in the
protocol stack and is used by specific applications to talk to one another. In this
case the applications are web browsers and web servers.

HTTP is a connectionless text based protocol. Clients (web browsers) send


requests to web servers for web elements such as web pages and images. After the
request is serviced by a server, the connection between client and server across
the Internet is disconnected. A new connection must be made for each request.
Most protocols are connection oriented.
Hypertext Transfer Protocol
Hypertext Transfer Protocol

When you type a URL into a web browser, this is what happens:
1. If the URL contains a domain name, the browser first connects to a domain
name server and retrieves the corresponding IP address for the web server.

2. The web browser connects to the web server and sends an HTTP request (via
the protocol stack) for the desired web page.

3. The web server receives the request and checks for the desired page. If the
page exists, the web server sends it. If the server cannot find the requested
page, it will send an HTTP 404 error message. (404 means 'Page Not Found' as
anyone who has surfed the web probably knows.)

4. The web browser receives the page back and the connection is closed.
Hypertext Transfer Protocol

5. The browser then parses through the page and looks for other page elements it
needs to complete the web page. These usually include images, applets, etc.

6. For each element needed, the browser makes additional connections and HTTP
requests to the server for each element.

7. When the browser has finished loading all images, applets, etc. the page will be
completely loaded in the browser window.
HTTP & Application
Programming Interface

In computer programming, an application programming interface (API) is a set


of subroutine definitions, protocols, and tools for building application software. In
general terms, it is a set of clearly defined methods of communication between
various software components.

An API approach is an architectural approach that revolves around providing a


program interface to a set of services to different applications serving different
types of consumers.

• Web API
• Remote API
Web API
Web API is a framework for building HTTP services that can be consumed by a broad
range of clients including browsers, mobiles, iphone and tablets almost same as web
services. Web API is typically done as HTTP/REST, nothing is defined, output can be
eg. JSON/XML, input can be XML/JSON/or plain data.

An example might be a shipping company API that can be added to an e-Commerce


focused website, to facilitate ordering shipping services and automatically include
current shipping rates, without the site developer having to enter the shipper's rate
table into a web database.
Remote API
Remote APIs allow developers to manipulate remote resources through protocols,
specific standards for communication that allow different technologies to work
together, regardless of language or platform.

For example, the Java Database Connectivity (JDBC) API allows developers to query
many different types of databases with the same set of functions, while the Java
remote method invocation API uses the Java Remote Method Protocol to allow
invocation of functions that operate remotely, but appear local to the developer.

Therefore, remote APIs are useful in maintaining the object abstraction in object-
oriented programming; a method call, executed locally on a proxy object, invokes the
corresponding method on the remote object, using the remoting protocol, and
acquires the result to be used locally as return value.
Web Application
architecture
Models Application
Model

• Model 1
• Model 2 (MVC) Architecture
Models 1 Architecture

As you can see in the above figure, there is picture which show the flow of
the model1 architecture.

1. Browser sends request for the JSP page


2. JSP accesses Java Bean and invokes business logic
3. Java Bean connects to the database and get/save data
4. Response is sent to the browser which is generated by JSP
Models 1 Architecture

Advantage of Model 1 Architecture


• Easy and Quick to develop web application

Disadvantage of Model 1 Architecture

• Navigation control is decentralized since every page contains the logic to


determine the next page. If JSP page name is changed that is referred by
other pages, we need to change it in all the pages that leads to the
maintenance problem.

• Time consuming You need to spend more time to develop custom tags in
JSP. So that we don't need to use scriptlet tag.

• Hard to extend. It is better for small applications but not for large
applications.
Models 2 MVC
Architecture
Model 2 is based on the MVC (Model View Controller) design pattern. The MVC
design pattern consists of three modules model, view and controller.

Model The model represents the state (data) and business logic of the application.

View The view module is responsible to display data i.e. it represents the
presentation.

Controller The controller


module acts as an interface
between view and model.
It intercepts all the requests
i.e. receives input and commands
to Model / View to change
accordingly.
Models 2 MVC Architecture

Advantage of Model 2 (MVC) Architecture

• Navigation control is centralized Now only controller contains the logic to


determine the next page.
• Easy to maintain
• Easy to extend
• Easy to test
• Better separation of concerns

Disadvantage of Model 2 (MVC) Architecture

• We need to write the controller code self. If we change the controller code,
we need to recompile the class and redeploy the application.
End OF Unit

You might also like