Structure of a web application
description
Transcript of Structure of a web application
![Page 1: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/1.jpg)
Structure of a web application 1
Structure of a web application
Dr Jim Briggs
![Page 2: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/2.jpg)
MVC
Structure of a web application 2
![Page 3: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/3.jpg)
Structure of a web application 3
MVC
• Model View Controller pattern• Way of keeping aspects of an
application separate• Applicable to all applications, not just
web ones
![Page 4: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/4.jpg)
Structure of a web application 4
Advantages of MVC• Good software engineering practice to maintain
separation of concerns• An application might have more than one user interface
– The elements of the user interface need to be kept separate from the parts that are common to each
• Different developers (with different skills) may be responsible for different aspects of the application– Frequently, user-interface designers responsible for the view – Conventional programmers responsible for the controller and
model– In some circumstances, the controller might be the
responsibility of an interaction engineer (or team)
![Page 5: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/5.jpg)
Structure of a web application 5
The structure of MVC
![Page 6: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/6.jpg)
Structure of a web application 6
Implementing webapps in Java
• Type 1 – all in JSP• Type 1.5 – JSPs that call JavaBeans to
do most of the processing• Type 2 – very little code in JSPs; servlet
used as controller; JavaBeans provide model
![Page 7: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/7.jpg)
Structure of a web application 7
Type 1.5
![Page 8: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/8.jpg)
Structure of a web application 8
Type 2
![Page 9: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/9.jpg)
APPLICATION LAYERS
Structure of a web application 9
![Page 10: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/10.jpg)
Structure of a web application 10
External3-tier architecture
3-tier Application Architecture
Presentation
Business Logic
Data Access Database
User
Other Apps
![Page 11: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/11.jpg)
Structure of a web application 11
Presentation Layer
• This is what the user sees and interacts with
• Sometimes called the GUI or client view
• Should not contain business logic or data access code
3-tier architecture
Presentation
Business Logic
Data Access
![Page 12: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/12.jpg)
Structure of a web application 12
Logic (Business) Layer
• The set of rules for processing business information
• Sometimes called middle tier or backend
• Should not contain presentation or data access code
3-tier architecture
Presentation
Business Logic
Data Access
![Page 13: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/13.jpg)
Structure of a web application 13
Data Access Layer
• The physical storage layer for data persistence
• Manages access to DB or file system
• Should not contain presentation or business logic code
3-tier architecture
Presentation
Business Logic
Data Access
![Page 14: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/14.jpg)
Structure of a web application 14
The 3-tier principles
• Each tier should be independent and should not expose dependencies related to the implementation
• Unconnected tiers should not communicate
3-tier architecture
Presentation
Business Logic
Data Access
![Page 15: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/15.jpg)
How tiers affect design
Structure of a web application 15
![Page 16: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/16.jpg)
IMPLEMENTATION ARCHITECTURES
Structure of a web application 16
![Page 17: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/17.jpg)
Single server (abstract)
Application
User Webserver
View Controller Business logic
Business objects
Persistence
Database
Structure of a web application 17
![Page 18: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/18.jpg)
Single server (servlet/JSP)
Application
User Web server
JSPs Servlets Session beans
Entity beans
Façade classes
Database
Structure of a web application 18
![Page 19: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/19.jpg)
Single server (JSF)
Application
User Web server
Facelets Backing beans
Session beans
Entity beans
Façade classes
Database
Structure of a web application 19
![Page 20: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/20.jpg)
Separate servers (abstract)
Application
User Web server
View Controller
Application server
Business logic
Business objects
Persistence
Database
Structure of a web application 20
![Page 21: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/21.jpg)
Separate servers (servlets/JSP)
Application
User Web server
JSPs Servlets
Application server
Session beans
Entity beans
Façade classes
Database
Structure of a web application 21
![Page 22: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/22.jpg)
Separate servers (JSF)
Application
User Web server
Facelets Backing beans
Application server
Session beans
Entity beans
Façade classes
Database
Structure of a web application 22
![Page 23: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/23.jpg)
JAVA BEANS
Structure of a web application 23
![Page 24: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/24.jpg)
Structure of a web application 24
JavaBeans• A JavaBean is a Java class that:
– has a parameterless constructor • (it could have other constructors as well)
– is capable of holding state through one or more private instance variables
• (and if necessary saving it to a persistent store)– implements a method called getX that returns the value of
readable property X– implements a method called setX that changes the value of
writable property X• (has both a setter and a getter for a read/write property)
– may also fire, and respond to, events• (but that ability is not important for our purposes at the moment)
![Page 25: Structure of a web application](https://reader035.fdocuments.in/reader035/viewer/2022062815/568168c8550346895ddfba48/html5/thumbnails/25.jpg)
Enterprise JavaBeans
• Entity beans• Session beans
– Stateless– Stateful– Singleton
• Message beans
• Dependency injection
• State management • Transaction
management• Security• Pooling• Interceptors
Structure of a web application 25