Anda di halaman 1dari 19

Introduction to JEE

Prof. Vipul Dabhi


Dept. of Information Technology,
Faculty of Technology,
Dharmsinh Desai University, Nadiad
J2SE Vs J2ME Vs J2EE
• J2SE : Java 2 Standard Edition
– Most basic and standard version of Java
– Used to create applications for Desktop environment
– Provides Base API’s (like java.lang, java.util)
• J2ME: Java 2 Micro Edition
– Useful to develop applications running on embedded systems,
mobiles and small devices
– J2ME uses many libraries and API’s of J2SE, as well as, many of
it’s own
• J2EE : Java 2 Enterprise Edition
– Useful to develop Web application and Distributed Application
– J2EE uses many components of J2SE

Introduction to JEE by Prof. Vipul Dabhi


What is Java EE?
 Java EE is a Sun specification implemented by independent vendors:
 IBM WebSphere, BEA Weblogic
 Jboss, GlassFish
 The Java EE platform uses a distributed multitiered application
model for enterprise applications.

Introduction to JEE by Prof. Vipul Dabhi


Web-Application

Example of Web-Servers: Apache HTTP Server, Microsoft Internet Information Services (IIS)
Image Source: Head First Servlets and JSP 2nd Edition - by Bryan Basham, Kathy Sierra & Bert Bates, O'Reilly
Introduction to JEE by Prof. Vipul Dabhi
HTML and HTTP
• HTML- HyperText Markup Language
– Web Server often send the browser a set of
instructions written in HTML.
• Tells the browser how to present the content to the
user
• HTTP – HyperText Transport Protocol
– Allows for simple request and response
conversation.
• The client sends an HTTP request.
• The Server answers with an HTTP response.

Introduction to JEE by Prof. Vipul Dabhi


Web-Application
• A web server can only understand the HTTP
request and serve that request with static
pages (html,gig,jpeg etc) only.
• The client of web-application is light-weight as
it requires browser only. (Thin client)
• Example: Browser-Website

Introduction to JEE by Prof. Vipul Dabhi


Distributed Application
• Software that executes on two or more
computers in a network.
• Software components are running on both
client and server sides
• It is not called a thin client
• Example: ATM-Bank Server

Introduction to JEE by Prof. Vipul Dabhi


Enterprise Application
• An Enterprise Application can be a
– Web-Application
– Distributed-Application
– Combination of Web-Application and Distributed-
Application

Introduction to JEE by Prof. Vipul Dabhi


Example of Enterprise Application

Payment
Online Paypal Broker
Shopping

Master Payment
VISA Maestro Gateways
Card
Client

SBI ICICI HDFC BOB Banks

Introduction to JEE by Prof. Vipul Dabhi


Components of J2EE
• JSP Useful to develop web applications

• Servlet

• EJB Useful to develop Distributed applications


• JMS

Introduction to JEE by Prof. Vipul Dabhi


Web-Server Vs Application Server
• Web Server is mostly designed to serve static content, though most Web
Servers have plugins to support scripting languages like PHP, ASP, JSP etc.
through which these servers can generate dynamic HTTP content.
• Most of the application servers have Web Server as integral part of them,
that means App Server can do whatever Web Server is capable of.
• Additionally App Server have components and features to support
Application level services such as Connection Pooling, Object Pooling,
Transaction Support, Messaging services etc.
• While servicing a page request, static contents (such as images/Static
HTML) are served by web server that interprets the request. Using some
kind of filtering technique (mostly extension of requested resource) web
server identifies dynamic content request and transparently forwards to
app server.
• Application server are more heavy than web server in terms of resource
utilization.

Introduction to JEE by Prof. Vipul Dabhi


Static Vs Dynamic Web-Site
Static Dynamic
Content is same each time page is Content is generated “on-the-fly” and
loaded. changes regularly
Content only changes when someone Page contains server side code, allows
updates and publishes the file. the server to generate unique content
when page is loaded.
HTML Code PHP, JSP, ASP Code to pull content from
Database
Example: About Us page with Example: Upcoming events page
background, mission and vision.

Introduction to JEE by Prof. Vipul Dabhi


Container

Introduction to JEE by Prof. Vipul Dabhi


JAR Vs WAR Vs EAR
• JAR: Java Archive
– all zipping algorithms are platform-dependent (For ex. Winzip works with
Windows only) JAR file can be zipped and unzipped by JVM irrespective of
OS.
– A JAR file encapsulates one or more Java classes, a manifest, and a descriptor.
– JAR files are the lowest level of archive.
– JAR files are used in J2EE for packaging EJBs and client-side Java Applications
• WAR: Web Archive
– Web modules which contain Servlet class files, JSP Files, supporting files, GIF
and HTML files are packaged as JAR file with .war (web archive) extension.
• EAR: Enterprise Archive
– All above files (.jar and .war) are packaged as JAR file with .ear (enterprise
archive) extension and deployed into Application Server.
Introduction to JEE by Prof. Vipul Dabhi
Pros and Cons of JAR, WAR, EAR Files
• Advantage
– The transportation of web-applications and
enterprise applications become easy.
– With JAR, WAR and EAR files, the deployment of
developed software is easy on client machines.
• Disadvantage
– Making minor changes in a Servlet, JSP or EJB
requires complete process of remaking and
redeployment of jar, war, ear files.

Introduction to JEE by Prof. Vipul Dabhi


What is WAR File?
• Ready to deployable package over web
container
• Contains things to be deployed
– Web components (servlets or JSPs)
– Server-side utility classes
– Static Web presentation content (HTML, CSS etc.)
– Client-side classes (applets and utility classes)

Introduction to JEE by Prof. Vipul Dabhi


How to create WAR File
• Use IDE of NetBeans
• Use ant tool after putting proper build
instruction in build.xml file
• Use jar cvf <filename>.war command under
build directory

Introduction to JEE by Prof. Vipul Dabhi


J2EE Application Development
LifeCycle
• Write and compile component code
– Servlet, JSP, EJB
• Write Deployment descriptors for components
– From Java EE 5, you can use annotations
• Assemble components into ready-to-
deployable package
• Deploy the package to application server

Introduction to JEE by Prof. Vipul Dabhi


Java EE Architecture

Introduction to JEE by Prof. Vipul Dabhi

Anda mungkin juga menyukai