Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
J2EE
1
J2EE Scenario
2
Client Web Server EIS Resources
Servlet
HTML
HTTP
XML JDBC
Client JSP DataBasee
XML
3
Business to Business
JMS Legacy
System
Browser JSP
JDBC
JNDI
Servlet Java Server Database
Stand-alone RMI
Clinet
JAVA IDL
Distribute
CORBA
Object
4
Web Application
A web application is a collection of servlets, html
pages, classes, and other resources that can be
bundled and run on multiple containers from
multiple vendors.
5
Web Application Environment
Database
Browser
Web Application
Container Container
EIS
JDK Distribute
CORBA
Objects
Operation System
6
JDK
All J2EE applications require the Java Developers
Kit to run Java classes or the Java Virtual
Machine (JVM).
7
Web Application Structure
Connector
Web
Container JSP Database
JDBC
Servlets
Browser JNDI
RMI EIS
.
.
Application
Container
EJB
Distribute
Java Classes CO RBA
O bjects
8
Container
9
Functions of Container
Environment configuration.
Resources.
10
Web Container
An entity that implements the Web component contract
of the J2EE architecture.
specify a runtime environment for Web components that
includes security, concurrency, life cycle management,
transaction, deployment, and other services
provide the same services as a JSP container and a
federated view of the J2EE platform APIs.
can run a Web application that is tagged as distributable
and that executes across multiple Java virtual machines
running on the same host or on different hosts.
11
Web Container Provider
Open Source
Tomcat
Business Product
WebLogic
WebShpere
12
Tomcat
jakarta.apache.org/tomcat/index.html
13
Application Container
An entity that implements the Java Classes
contract of the J2EE architecture.
14
Application Container Provider
Open Source
JBOSS
Business Product
WebLogic
WebShpere
Silverstream
15
Connectors
The connector is where the abstract really meets
the concrete.
16
JDBC
17
JNDI
provides access to naming and directory services
18
Tools
Ant
IDE
Jbuilder
NetBeans
19
Data format used in Web
Application
HTML
JSP
Image files
Gif
JPEG
Class file
Source code
Complied code
XML
JAR file: used in J2EE for packaging EJBs and client-side
Java Applications
WAR file: web applications made from Servlets, JSPs,
and supporting classes
EAR file: contain all of the components that make up a 20
particular J2EE application
Web Application can be exist in
WAR files
directory
21
Web Application Archive File
22
Basic Web Application Directory
WebApp/ (Web Application Root Folder)
Index.HTML
Index.JSP
WEB_INF/
WEB.XML
Classes/
Lib/
23
Root
The root of this hierarchy serves as a document
root for serving files that are part of this context.
For example,
a web application located at /catalog in a web
server
the index.html file located at the base of the
web application hierarchy can be served to
satisfy a request to /catalog/index.html.
24
WEB-INF
25
Contents of the WEB-INF directory
26
Customize Web Application
directory
WebApp/ (Web Application Root Folder)
Index.HTML
Index.JSP
SRC/
images/
WEB_INF/
WEB.XML
Classes/
Lib/
27
Web.xml
The web.xml file format is defined in the
Servlet Specification, so this file format
will be used in every servlet-conforming
Java servlet container.
28
Deployment description of Web
Application
Web.xml
- <resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
30
Configure resources used by Web
Application
use Server.xml to configure resources
Web container runs in an object-oriented way
dynamically builds its object structure at
runtime, based on the configuration files
each major element in the server.xml file creates
a software "object," and the ordering and
nesting of these elements sets up processing
pipelines that allow you to perform filtering,
grouping.
31
Context in server.xml
32
key attributes in a Context
Attribute Meaning
crossContext Specifies whether
ServletContext.getContext(otherWebApp) should
succeed (true) or return null (false)
34