Rolle von Java Verteilte Verarbeitung mit Java J2EE Übersicht J2EE Details
Java Web-based Programming & J2EE Architecture...
Transcript of Java Web-based Programming & J2EE Architecture...
![Page 1: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/1.jpg)
1Huihoo - Enterprise Open Source http://www.huihoo.com
Java Web-based Programming & J2EE Architecture
Peter.Cheng Email: [email protected]
http://www.huihoo.org
![Page 2: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/2.jpg)
2Huihoo - Enterprise Open Source http://www.huihoo.com
Course Goal
The main goal of this course is to provide you with the knowledge for Java web-based programming (JSP, Servlet, Struts), MVC Design pattern, J2EE architectures
![Page 3: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/3.jpg)
3Huihoo - Enterprise Open Source http://www.huihoo.com
Course Overview
This course covers the following areas:
J2EE Technology overview
Web-based Programming Model
MVC Design Pattern and Struts
Framework
J2EE Architectures
Build a J2EE developer Team
![Page 4: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/4.jpg)
4Huihoo - Enterprise Open Source http://www.huihoo.com
How To Use Course Materials
Lecture The instructor will present information specific to the topic of the module. This information will help you learn the knowledge and skills necessary to succeed with the exercises.
Exercise Lab exercises will give you the opportunity to practice your skills and apply the concepts presented in the lecture.
Think Beyond Thought-provoking questions are posed to help you apply the content of the module or predict the content in the next module.
![Page 5: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/5.jpg)
5Huihoo - Enterprise Open Source http://www.huihoo.com
Software Architecture
OS (Unix, Windows, Linux, Mac, others)
J2EE Infrastructure(SunOne, Weblogic, Websphere, etc)
APIs, specifications
ApplicationApplication
Virtual Platform
Upper Platform
Lower Platform
![Page 6: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/6.jpg)
6Huihoo - Enterprise Open Source http://www.huihoo.com
Architecture and the cube
Client
Presen
tation
Security
Manageability
Reliability
Availability
Scalability
Busines
s
integ
ratio
n
Application
Resou
rce
APIs, specifications
Middleware( Web, app server)
OS (Solaris, Windows, Linux ,etc)
Manageability
Security
Reliability
Availability
Scalability
Presentation
Client
Business
Integration
ResourceApplication
Virtual Platform
Upper Platform
Lower Platform
![Page 7: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/7.jpg)
7Huihoo - Enterprise Open Source http://www.huihoo.com
Java Platform Overview
JVM JVM KVM CardVM
Java Hotspot ™ JVM Card VM
Java Programming Language
Java 2Enterprise
Edition(J2EE)Core APIs
Java 2Standard
Edition(J2SE)
Core APIs
Java 2 ME APIs
PersonalProfile
RMIProfile
Other CDC
Profiles...
FundamentalProfile MIDP
OptionalPackage
Optional Package
KVM
Java Card APIs
![Page 8: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/8.jpg)
8Huihoo - Enterprise Open Source http://www.huihoo.com
Java is everywhere
![Page 9: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/9.jpg)
9Huihoo - Enterprise Open Source http://www.huihoo.com
J2EE 3-Tier Architecture
Presentation
JavaApplication
JavaApplication
PureHtml
PureHtml
AppletApplet
MobileDevice
MobileDevice
J2MEJ2ME
Presentation
Web ServerWeb Server
J2EEPlatformJ2EE
Platform
JSPJSP
JavaServletJava
Servlet
Enterprise
Information
System
EISEIS
OtherSystem
OtherSystem
Business Logic
EJB ContainerEJB Container
J2EEPlatformJ2EE
Platform
EJBEJB
EJBEJB
Server Side
DesktopDesktop
JavaApplication
JavaApplication
BrowserBrowser
PureHtml
PureHtml
AppletApplet
MobileDevice
MobileDevice
J2MEJ2ME
Client Side
![Page 10: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/10.jpg)
10Huihoo - Enterprise Open Source http://www.huihoo.com
Computing Model is changing
Model Client/Server Browser/Server
UI Application Browser (html)
Maintain Hard Easy
Couple High Lower
![Page 11: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/11.jpg)
11Huihoo - Enterprise Open Source http://www.huihoo.com
History of Web Applications
Common Gateway Interface
Main ProcessMain ProcessChild process for CGI1Child process for CGI1
Child process for CGI2Child process for CGI2
Child process for CGI1Child process for CGI1
Request for CGI1
Request for CGI2
Request for CGI1
![Page 12: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/12.jpg)
12Huihoo - Enterprise Open Source http://www.huihoo.com
History of Web Applications
Java Servlet
Main ProcessMain Process
JVM
Servlet1
Request for Servlet1
Servlet2
thread
thread
Request for Servlet2
Request for Servlet1
![Page 13: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/13.jpg)
13Huihoo - Enterprise Open Source http://www.huihoo.com
Web Tier – HTTP Request/Response Model
• A Client – a web browser• Send a request for a resource to a server• Server sends back a response corresponding to the
resource
![Page 14: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/14.jpg)
14Huihoo - Enterprise Open Source http://www.huihoo.com
The Servlet
@see HelloWorldServlet.javahttp://localhost:8081/servlet/HelloWorldServlet
![Page 15: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/15.jpg)
15Huihoo - Enterprise Open Source http://www.huihoo.com
The Servlet – single instance
Web Server
Servlet
request
Servletrequest
request
request
@see SingleInstance.java
http://localhost:8081/servlet/SingleInstance
![Page 16: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/16.jpg)
16Huihoo - Enterprise Open Source http://www.huihoo.com
The Servlet – Single Thread Model
Web ServerServlet PoolServlet Poolrequest
ServletInstance
ServletInstance
ServletInstance
ServletInstance
request
request
request
![Page 17: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/17.jpg)
17Huihoo - Enterprise Open Source http://www.huihoo.com
Web Tier - What’s JSP?
JavaServer Pages ,for short—is a Java-based technology that simplifies the process of developing dynamic web sites.
A JSP page contains standard markup language elements, such as HTML tags, just like a regular web page.
A JSP page also contains special JSP elements that allow the server to insert dynamic content in the page.
![Page 18: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/18.jpg)
18Huihoo - Enterprise Open Source http://www.huihoo.com
HTML vs. JSP
HTML
<html>
<head>
<body><LI><A>Why Use JSP</A></LI>
</body>
</html>
JSP
<html><head><body><jsp:useBean…/></body></html>
![Page 19: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/19.jpg)
19Huihoo - Enterprise Open Source http://www.huihoo.com
Why use JSP?
Embedding Dynamic Elements in HTML Pages
CompilationCGI/Perl require the server to load an interpreter and the target script each time the page is requested.a JSP page is always compiled before it's
processed by the server.
Integration with Enterprise Java APIsJDBC, JMS, EJB, etc
![Page 20: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/20.jpg)
20Huihoo - Enterprise Open Source http://www.huihoo.com
Inside the web server
Web container
JSP Engine
Servlet Engine
Web server
client
http request http response
Completedservlet
JSP
![Page 21: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/21.jpg)
21Huihoo - Enterprise Open Source http://www.huihoo.com
Web Programming Model - 1
JSP(View)
Client Application
request
responseJavaBeans
(Model)JavaBeans
(Model)Data
![Page 22: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/22.jpg)
22Huihoo - Enterprise Open Source http://www.huihoo.com
Web Programming Model - 2
Servlet(Controller)
Client Application
request
response
JavaBeans(Model)
JavaBeans(Model)
JSP(View)
Data
@see ControllerServlet.java welcome.jsp login.jsp
![Page 23: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/23.jpg)
23Huihoo - Enterprise Open Source http://www.huihoo.com
MVC (Model-View-Controller)
Model• Encapsulates application state• Responds to state queries• Exposes application functionality• Notifies views of changes
View• Render the model• Requests model update• Send user input to controller
Controller• Define application behavior• Maps user actions to model update• Select view for response• One for each functionality
update state change
user input
view select
query model state
change notification
![Page 24: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/24.jpg)
24Huihoo - Enterprise Open Source http://www.huihoo.com
Basic MVC Control Flow
ControllerServlet Controller ViewResolverHandlerMapping View
:getHandler(request)
Handler: Controller
:handleRequest(request, response)
:return Model And View
resolveViewname(name, local)
:return View reference
:render (model, request, response)
mapping.xml
![Page 25: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/25.jpg)
25Huihoo - Enterprise Open Source http://www.huihoo.com
Open Source MVC Framework
Struts www.apache.org
WebWork www.opensymphony.com
Maverick http://sourceforge.net/project/mav
![Page 26: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/26.jpg)
26Huihoo - Enterprise Open Source http://www.huihoo.com
Framework vs. Component
Framework
Application 3Extension
Application 2Extension
Application 1Extension
MainApplication
Library2
Library1
![Page 27: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/27.jpg)
27Huihoo - Enterprise Open Source http://www.huihoo.com
Functional Application Tier
![Page 28: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/28.jpg)
28Huihoo - Enterprise Open Source http://www.huihoo.com
The Struts framework is used within the web tier
![Page 29: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/29.jpg)
29Huihoo - Enterprise Open Source http://www.huihoo.com
The execute() method call by controller
![Page 30: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/30.jpg)
30Huihoo - Enterprise Open Source http://www.huihoo.com
Struts Architecture
![Page 31: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/31.jpg)
31Huihoo - Enterprise Open Source http://www.huihoo.com
What’s J2EE Technology
Components:Application clientsAppletsWeb componentsBusiness components
ContainersManage lifecycle of business componentsProvide a federated view of J2EE APIsProvide runtime support for components
![Page 32: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/32.jpg)
32Huihoo - Enterprise Open Source http://www.huihoo.com
J2EE Architectures
![Page 33: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/33.jpg)
33Huihoo - Enterprise Open Source http://www.huihoo.com
J2EE Application Model
Client
Client
Client
Client
Client Enterprise Information
Systems (EIS):
Relational-Database,Legacy Applications,
ERP Systems
EJBEJB
EJBEJB
Other Services:JNDI, JMS,Java Mail
Other Services:JNDI, JMS,Java Mail
ApplicationServer
ApplicationServer
JSP/Servlet
Firewall
![Page 34: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/34.jpg)
34Huihoo - Enterprise Open Source http://www.huihoo.com
J2EE Platform Specification
JND
I
J2SE
JMS
RM
I/IIO
P
JDB
C
DatabaseDatabase
AppClientApp
Client
App Client ContainerApp Client Container
HTTP/HTTPSHTTP/HTTPS
J2SE
RMI/IIOPRMI/IIOP
J2SE
JND
I
JMS
RM
I/IIO
P
JDB
C
JTA JavaMail
JAF JND
I
JMS
RM
I/IIO
P
JDB
C
JTA JavaMail
JAF
HTTP/HTTPSHTTP/HTTPS
Applet Container
Applet Container
AppletApplet JSPJSP ServletServlet EJBEJB
Web ContainerWeb Container EJB ContainerEJB Container
RMI/IIOPRMI/IIOP
J2SEJ2SE
![Page 35: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/35.jpg)
35Huihoo - Enterprise Open Source http://www.huihoo.com
Vertical Scalability
Web Server
Application Server
DBMS Server
Capacity
Reliability
Availability
Manageability
Any machine leads to a system failure
![Page 36: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/36.jpg)
36Huihoo - Enterprise Open Source http://www.huihoo.com
Horizontal Scalability
Capacity
Reliability
Web Server
Application Server DBMS
Server
Web Server
Web Server
Application Server
DBMS Server Array
Array
Availability
Manageability
![Page 37: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/37.jpg)
37Huihoo - Enterprise Open Source http://www.huihoo.com
Design J2EE-Based Application
EJB is not the only technology for implementing the middle tier in J2EE applications
Design to Java interfaces, not concrete classes, and not technologies
![Page 38: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/38.jpg)
38Huihoo - Enterprise Open Source http://www.huihoo.com
Non-distributed Architectures
Web Application with Business Component Interfaces
DB LegacyEIS
Middle Tier
(Business Logic)
UI Tier
Business interface
Implementation
Servlet/Web Tier classes
Web C
ontainer
J2EE Application Server
![Page 39: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/39.jpg)
39Huihoo - Enterprise Open Source http://www.huihoo.com
Web Application that Accesses Local EJBs
DB LegacyEIS
Middle Tier
(Business Logic)
UI Tier
Business interface
Business Delegate
Servlet/Web Tier classes
Web C
ontainer
J2EE Application Server (Single JV
M)
Session Bean
Entity Bean (Optional)
Local EJB Invocation
EJB C
ontainer
![Page 40: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/40.jpg)
40Huihoo - Enterprise Open Source http://www.huihoo.com
Distributed Architectures
DB LegacyEIS
Middle Tier
(Business Logic)
UI Tier
Business interface
Business Delegate
Servlet/Web Tier classes
Web C
ontainer
J2EE App Server
RMI Remote EJB Invocation
EJB C
ontainer
J2EE App Server
Session Bean
Entity Bean (Optional)
![Page 41: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/41.jpg)
41Huihoo - Enterprise Open Source http://www.huihoo.com
The future of J2EE
“Service”
Couple
Small 粗糙
Tighter
loose
Transport/interfa
ce
� (Latency)
� (Bandwidth)
� (Security)
� (Transparency)� ...
![Page 42: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/42.jpg)
42Huihoo - Enterprise Open Source http://www.huihoo.com
Service-Oriented Architecture
Network Infrastructure
WebServices
![Page 43: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/43.jpg)
43Huihoo - Enterprise Open Source http://www.huihoo.com
New J2EE Architecture
Rich ClientsJ2EE Server: JSP/Servlet/EJB
Services
MIDP Devices
Browsers HTML/XML
XMLP/SOAPXHTML/WML
XMLP/SOAP
XMLP/SOAP
JSP
EJB
XML
JAX-RPC
JAXM
JAXB
JAXP
JDBCDBMS
JMSConnectors Existing
Apps
![Page 44: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/44.jpg)
44Huihoo - Enterprise Open Source http://www.huihoo.com
Application Driven
![Page 45: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/45.jpg)
45Huihoo - Enterprise Open Source http://www.huihoo.com
Service Driven
![Page 46: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/46.jpg)
46Huihoo - Enterprise Open Source http://www.huihoo.com
Service on demand
![Page 47: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/47.jpg)
47Huihoo - Enterprise Open Source http://www.huihoo.com
Builder a team
Markup developerThis will encompass HTML/XHTML development and possibly JavaScript.Presentation developerResponsible for more technical presentation-tier work, rather than designing good-looking HTML. Web-tier Java developerResponsible for MVC framework action classes, JSP tag handlers, and web-tier helper classes.
![Page 48: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/48.jpg)
48Huihoo - Enterprise Open Source http://www.huihoo.com
Builder a team
Business object developerResponsible for implementing application business logic. Business object developers will use EJB where appropriate, and should have a sound understanding of EJB. Data access specialistJava developer responsible for efficient DBMS access. Often this role will be taken on by business object developers. DBASpecialist in the underlying database. DBAscan provide valuable assistance to J2EE developers in vital areas such as ensuring good performance and correct locking behavior.
![Page 49: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/49.jpg)
49Huihoo - Enterprise Open Source http://www.huihoo.com
Exercises
Rewrite, compile, and run a program that use the JSP, Servlet
Rewrite, compile, and run a program that use the MVC design pattern
![Page 50: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/50.jpg)
50Huihoo - Enterprise Open Source http://www.huihoo.com
Think Beyond
How to apply MVC framework to your project?
![Page 51: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/51.jpg)
51Huihoo - Enterprise Open Source http://www.huihoo.com
Common Abbreviations and Acronyms
API - Application programming interfaceCORBA – Common Object Request Broker ArchitectureEIS – Enterprise Information SystemEJB – Enterprise JavaBeansERP – Enterprise Resource PlanningJAR – Java ArchiveJ2EE – Java 2 Platform, Enterprise EditionJMSJNDIJSPJTAJTSOMGORB
![Page 52: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/52.jpg)
52Huihoo - Enterprise Open Source http://www.huihoo.com
Further Reading
Architecting and Design J2EE Applications SL-425 Sun Microsystems 2000
Enterprise JavaBeans Programming SL-351 SunMicrosystems 2000
Rod Johnson Expert One-on-One J2EE Design and
Development Wrox Press 2003
![Page 53: Java Web-based Programming & J2EE Architecture …docs.huihoo.com/services/pdf/00-Java-Web-2004.pdfJava Web-based Programming & J2EE Architecture Peter.Cheng Email: founder_chen@yahoo.com.cn](https://reader031.fdocuments.net/reader031/viewer/2022030418/5aa42d927f8b9ae7438badfc/html5/thumbnails/53.jpg)
53Huihoo - Enterprise Open Source http://www.huihoo.com
Resources
http://java.sun.com/j2ee
http://java.sun.com/jcp
http://www.w3.org/