J2EE
Objectives
Organisation
Part-I Introducing J2EE
Current problems with enterprise-wide networked application environments
Future needs
What is J2EE?
How J2EE meets the challenge?
A taste of J2EE
Part-II Components of J2EE
J2EE application programming model
Components & component APIs – an in-depth look
Interactions between the components
A component-based development approach
Part-III Application Development with J2EE
Developing Servlets and JSPs
Developing Enterprise JavaBeans (EJBs)
Interactions between the components
Architecting a simple J2EE application
Part-IV J2EE Web Application Servers
Implementing J2EE : Web application servers
Features of Web application servers
J2EE certification for Web application servers
Future of J2EE
J2EE
Assumed knowledge
Part-I Organization
OBJECTS OBJECTS
OBJECTS OBJECTS
Lack of portability.
Entire system becomes a huge and complex behemoth
System more and more difficult to handle – as the business becomes
more and more complex.
Introducing J2EE
Current problems with enterprise application environments
Dept 4
Future Needs
Introducing J2EE
Future needs
Business must embrace the Internet and e-Commerce – not only for
growth, but for very survival !
Need to face a whole new set of problems like Security , Scalability,
Load-balancing , Fail-over , Availability
Introducing J2EE
Future needs
What is J2EE?
Introducing J2EE
What is J2EE?
EJB CONTAINER
CLIENTS
WEB CONTAINER
E IS
ENTERPRISE SERVICES
HTML
RMI - IIOP
Hardware / OS Independent
Adherence to OOP
CLASS CLASS
CLASS CLASS
CLASS
CLASS
BUSINESS LOGIC
(EJB Container )
ENTERPRISE SERVICES
A taste of J2EE
Introducing J2EE
A taste of J2EE
PRESENTATION /
CLIENTS BACKEND
BUSINESS LOGIC
SERVLETS
JSP
Java Servlets
Java Server Pages (JSP)
Enterprise JavaBeans (EJBs) EJB
Java Database Connectivity (JDBC)
Java Messaging Services (JMS)
JDBC
Java Naming and Directory Interface (JNDI)
Java Transaction Services (JTS)
JavaMail
XML
Introducing J2EE
A taste of J2EE
WEB APPLICATION
SERVERS
Organization
SERVLETS
J2EE Application
JSP Programming
Model
EJB
JDBC
Components of J2EE
J2EE Application Programming Model
BUSINESS LOGIC
(EJB Container )
CLIENT BACK END
TIER TIER
PRESENTATION LOGIC
(Web Components)
ENTERPRISE SERVICES
Applets
BUSINESS LOGIC
(EJB Container )
Applets, Javabeans
ENTERPRISE SERVICES
PRESENTATION LOGIC
(Web Components)
External Clients from
INTERNET
(Browsers , WAP etc.)
SERVLETS
Applets
BACK END
XML TIER
ENTERPRISE SERVICES
HTML
Applets
EJB EJB
JSP
ENTERPRISE SERVICES
HTML
Applets
EJB EJB
JSP
EJB EJB
XML
HTML
RMI - IIOP
Applets
EJB EJB
JSP Enterprise
Information
Systems
EJB EJB
(Databases,
XML
ERP,
Legacy Systems)
Internal Clients from
INTRANET
(Browsers , Desk top
Applications etc.)
ENTERPRISE SERVICES
Applets, Javabeans WML
HTML
RMI - IIOP
Applets
EJB EJB
JSP Enterprise
Information
Systems
EJB EJB
(Databases,
XML
ERP,
Legacy Systems)
Internal Clients from
INTRANET
(Browsers , Desk top
Applications etc.)
ENTERPRISE SERVICES
Applets, Javabeans WML
HTML
RMI - IIOP
EJB EJB
SERVLETS
EJB EJB
JSP
EJB EJB
HTML
Components of J2EE
Components and Component APIs - an in-depth look
Java Servlets
PRESENTATION LOGIC
(Web Components)
SERVLETS
JSP
HTTP
Clients
(Internal & External)
XML
WML
HTML
PRESENTATION LOGIC
(Web Components)
SERVLETS
JSP
HTTP
Clients
(Internal & External)
XML
WML
HTML
Another set of server side Java APIs to enhance web server functionality
Collecting data / presenting processed results to the client
Java snippets can be embedded into normal HTML code
Closely linked interaction with JavaBeans API
Components of J2EE
Components and Component APIs - an in-depth look
EJB EJB
JSP
SERVLETS
Informix
JDBC
EJB JDBC API
Driver/
DB API Oracle
Other
Java SQL Server
Classes
LDAP
SERVLETS
Server
DNS
RMI Server
Transmission
M M M
Enterprise
JMS API Messaging
System
M M M
Reception
JDBC
API
EJB JTA
Transaction
Monitor
Other
Transactional
Classes
EJB EJB
EJB
A component-based development
approach
EJB
EJB
Components of J2EE
A component-based development approach
Pluggable Architecture
SERVLETS
EJB EJB
Generic
Utilities
EJB
JSP
Organization
SERVLETS JSP
SERVLETS
Server side Java Classes, that reside in J2EE Presentation Logic Tier
Servlets are based on Request – Response models
All Servlets extend javax.servlet.Servlet Interface.
Most of the application Servlets extend javax.servlet.http.HttpServlet
class
ServletRequest and ServletResponse objects enable interaction with
the clients
Instantiate EJBs for business data processing
Application Development with J2EE
Developing Servlets and JSPs
Servlets - Lifecycle
Does Not Exist
import javax.servlet.*;
import javax.servlet.http.*;
out.println("<html>");
out.println("<head><title>Simple Servlet</title></head>");
out.println("<body>");
out.println("<h1>Hello J2EE !</h1>");
out.println("</body></html>");
}
}
Application Development with J2EE
Developing Servlets and JSPs
JSP
JSP - Lifecycle
Does Not Exist
<%!
String a = “hai”;
String b = “hai J2ee”;
%>
<HTML>
<h1> Current Date </h1>
Today’s date is : <%= new Date().toString() %>
<%
if (a.equalsIgnoreCase(b))
{
%>
<font name=”ariel”>A is equal to B</font>
<%
}
%>
</HTML>
Application Development with J2EE
Developing Servlets and JSPs
A Simple JavaBean
public class Presentation {
//attributes
protected String session;
protected String speaker;
protected int duration_hours;
//constructor method
public Presentation () {
this.session = “J2EE Tutorial”;
this.speaker = “S.Gokul”;
this.duration_hours = 4;
}
//Accessor Methods
public String getSession()
{…}
public void setSession()
{…}
………
}
Application Development with J2EE
EJB EJB
EJB EJB
EJB EJB
Process data
Return Results
Application Development with J2EE
Developing Enterprise JavaBeans
EJB
EJB
Entity EJBs
EJB
EJB EJB
JSP
Process data
Return Results
Forward
Response
with Results
RESPONSE
Response
Application Development with J2EE
Interactions between the Components
The necessary EJBs / Servlets and JSPs are developed and deployed
in the J2EE server
Server is started
A client request hits a Servlet
Servlet gathers / validates the input data, creates an EJB and forwards
the data to EJB for processing
EJB processes the data by applying business rules / interacting with
the database, and responds with the processed results.
Servlet gathers the response and forwards to a JSP appropriately.
JSP loads the response HTML page to the client.
Application Development with J2EE
Application Sequence
Presentation Logic Business Logic
Process data
Return Results (True or False)
Forward
Response
with Results
RESPONSE
Response
Application Sequence
Table Details
NAME
LOGINNAME
PASSWORD
AGE
SERVICE
Application Development with J2EE
Architecting a simple J2EE Application
Servlet Code
package portal;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.URL;
import javax.ejb.*;
import javax.naming.*;
session_ejb.remove();
}
catch (Exception e){
e.printStackTrace();
}
Application Development with J2EE
Architecting a simple J2EE Application
if (user != null)
{
p.put(Context.SECURITY_PRINCIPAL, user);
if (password == null) password = "";
p.put(Context.SECURITY_CREDENTIALS, password);
}
return new InitialContext(p);
}
Application Development with J2EE
Architecting a simple J2EE Application
//...
}
catch (Exception e){
e.printStackTrace();
}
Application Development with J2EE
Architecting a simple J2EE Application
import javax.ejb.*;
import java.rmi.RemoteException;
}
Application Development with J2EE
Architecting a simple J2EE Application
import javax.ejb.*;
import java.rmi.RemoteException;
}
Application Development with J2EE
Architecting a simple J2EE Application
Organization
WEB
APPLICATION
SERVER
SERVLETS
WEB EJB
APPLICATION
SERVER
JSP EJB
Implementing J2EE -
Web Application Servers
Web Application Servers
Implementing J2EE - Web Application Servers
WEB
APPLICATION
SERVER
WEB
APPLICATION
SERVER
WEB
APPLICATION
SERVER
WEB
APPLICATION
SERVER
???
Wow !
WEB
APPLICATION
SERVER
!!!! @#$%!
Performance-based Features
Technical Features
WEB
APPLICATION
SERVER
Administrative Features
Miscellaneous Features
Future of J2EE
Web Application Servers
Future of J2EE
WEB
APPLICATION
SERVER
RECAP
Introducing J2EE
Current problems with enterprise-wide networked application environments
Future needs
What is J2EE?
How J2EE meets the challenge?
A taste of J2EE
Components of J2EE
J2EE application programming model
Components & component APIs – an in-depth look
Interactions between the components
A component-based development approach
Application Development with J2EE
Developing Servlets and JSPs
Developing Enterprise JavaBeans (EJBs)
Interactions between the components
Architecting a simple J2EE application
J2EE Web Application Servers
Implementing J2EE : Web application servers
Features of Web application servers
J2EE certification for Web application servers
Future of J2EE