Web-Tier
DESIGNING ENTERPRISE APPLICATIONS WITH J2EE
CHAP: #4
BY:KASHF-UL-HUDA
J2EE Platform
oLayered set of system services
oTop layer of a “stack” of services that support an application.
oThe highest-level division is between
functions that are specific to a particular
application and those that occur in all Web applications.
oShare a common set of basic requirements
Web-Tier Application Structure
Sits on top of the J2EE platform
Providing common application functionality such as
◦ Dispatching requests
◦ Invoking model methods
◦ Selecting and Assembling views
Framework classes and interfaces are structural (Load bearing elements, underpinnings)
◦ Application developers extend, use, or implement
framework classes and interfaces to perform application-specific functions.
Web-Tier Application Framework Design
Model-View-Controller (“MVC”) is architectural design pattern for interactive applications.
Three separate modules:
◦ one for the application model with its data representation and business logic
◦ the second for views that provide data presentation and user input
◦ the third for a controller to dispatch requests and control flow.
Web-Tier Application Framework Design
MVC separates design concerns (data persistence and behavior, presentation, and control)
◦ decrease code duplication
◦ centralize control
◦ making the application more easily modifiable
Web-Tier Application Framework Design
Web tier does four basic things in a specific order
Web-Tier Application Framework Design
An enterprise application’s Web tier commonly has the following requirements:
◦ serving current and future client types.
◦ Web-tier controller must be maintainable and extensible
◦ Maintain application’s complexity, scalability, and software quality
◦ Choose appropriate technology for generating dynamic content
2.1 Structuring the Web Tier
Web-Tier discusses 2 Models.
◦ Model 1
◦ Model 2
Model 1: No controller servlet (hyperlinks, request parameters)
Model 2: servlet manages client communication and business logic execution
◦ easier to maintain and extend
◦ Provides a single point of control
MVC application framework implement a Model
2 application.
Web-Tier MVC Controller Design
Use servlets as controllers for processing requests and selecting views.
Front controller is responsible to receive request from client and dispatch it to application
model.
Centralizes an application’s request processing and view selection in a single component.
Selects and formats the next client view.
Controller Tasks
Identify the operations to perform.(Get, Post, URL mapping suffix and prefix)
Invoke model Method(if-else, Abstract Action)
Controlling Dynamic screen flow:
◦ The succession of views that a Web application user sees is called screen flow
Serve multiple client types.
Controlling Dynamic Screen flow
Support Multiple Client Types
Separate controller for each client type
Protocol router determine type of client from HTTP “user header”
Web-Tier MVC View Design
Display data produced by the MVC
model.
◦ Templating
A template is a presentation compone-
nt that composes separate sub-views
into a page with a specific layout
Web-Tier MVC Model Design
An MVC application model both represents business data and implements business logic.
Web Application Frameworks
J2EE BluePrints Web Application Framework (“WAF”)
This framework offers:
◦ Front Controller servlet
◦ Abstract action class
◦ Templating service
◦ Several generic custom tags
◦ Internationalization support
◦ Suitable for small, non-critical applications
◦ Learning purposes
Web Application Frameworks
Apache Struts
◦ Under development
◦ open-source
◦ highly configurable
◦ Large (and growing) feature list
◦ Include a Front Controller
◦ Action classes and mappings
◦ Utility classes for XML
◦ Automatic population of server-side JavaBeans
◦ Web forms with validation
◦ Internationalization support.
Web Application Frameworks
JavaServer Faces
◦ a Java specification for building component-based user interfaces for web applications and was
formalized as a standard through the Java Community Process being part of the Java Platform,
Enterprise Edition.
◦ Only for presenting user interface
◦ Support internationalization
◦ Validation
◦ multiple client types, and accessibility
◦ Standardization of the architecture and API will allow tool interoperation and the development of
portable, reusable Web-tier GUI component libraries.
Benefits of MVC
Decouples presentation and logic into separate components
Separates developer roles
Provides a central point of control
Facilitates unit testing and maintenance
Can be purchased instead of built
Provides a rich set of features
Encourages the development and use of standardized components
Provides stability
Has community support

Web tier-framework-mvc

  • 1.
    Web-Tier DESIGNING ENTERPRISE APPLICATIONSWITH J2EE CHAP: #4 BY:KASHF-UL-HUDA
  • 2.
    J2EE Platform oLayered setof system services oTop layer of a “stack” of services that support an application. oThe highest-level division is between functions that are specific to a particular application and those that occur in all Web applications. oShare a common set of basic requirements
  • 3.
    Web-Tier Application Structure Sitson top of the J2EE platform Providing common application functionality such as ◦ Dispatching requests ◦ Invoking model methods ◦ Selecting and Assembling views Framework classes and interfaces are structural (Load bearing elements, underpinnings) ◦ Application developers extend, use, or implement framework classes and interfaces to perform application-specific functions.
  • 4.
    Web-Tier Application FrameworkDesign Model-View-Controller (“MVC”) is architectural design pattern for interactive applications. Three separate modules: ◦ one for the application model with its data representation and business logic ◦ the second for views that provide data presentation and user input ◦ the third for a controller to dispatch requests and control flow.
  • 5.
    Web-Tier Application FrameworkDesign MVC separates design concerns (data persistence and behavior, presentation, and control) ◦ decrease code duplication ◦ centralize control ◦ making the application more easily modifiable
  • 6.
    Web-Tier Application FrameworkDesign Web tier does four basic things in a specific order
  • 7.
    Web-Tier Application FrameworkDesign An enterprise application’s Web tier commonly has the following requirements: ◦ serving current and future client types. ◦ Web-tier controller must be maintainable and extensible ◦ Maintain application’s complexity, scalability, and software quality ◦ Choose appropriate technology for generating dynamic content
  • 8.
    2.1 Structuring theWeb Tier Web-Tier discusses 2 Models. ◦ Model 1 ◦ Model 2 Model 1: No controller servlet (hyperlinks, request parameters) Model 2: servlet manages client communication and business logic execution ◦ easier to maintain and extend ◦ Provides a single point of control MVC application framework implement a Model 2 application.
  • 9.
    Web-Tier MVC ControllerDesign Use servlets as controllers for processing requests and selecting views. Front controller is responsible to receive request from client and dispatch it to application model. Centralizes an application’s request processing and view selection in a single component. Selects and formats the next client view.
  • 10.
    Controller Tasks Identify theoperations to perform.(Get, Post, URL mapping suffix and prefix) Invoke model Method(if-else, Abstract Action) Controlling Dynamic screen flow: ◦ The succession of views that a Web application user sees is called screen flow Serve multiple client types.
  • 11.
  • 12.
    Support Multiple ClientTypes Separate controller for each client type Protocol router determine type of client from HTTP “user header”
  • 13.
    Web-Tier MVC ViewDesign Display data produced by the MVC model. ◦ Templating A template is a presentation compone- nt that composes separate sub-views into a page with a specific layout
  • 14.
    Web-Tier MVC ModelDesign An MVC application model both represents business data and implements business logic.
  • 15.
    Web Application Frameworks J2EEBluePrints Web Application Framework (“WAF”) This framework offers: ◦ Front Controller servlet ◦ Abstract action class ◦ Templating service ◦ Several generic custom tags ◦ Internationalization support ◦ Suitable for small, non-critical applications ◦ Learning purposes
  • 16.
    Web Application Frameworks ApacheStruts ◦ Under development ◦ open-source ◦ highly configurable ◦ Large (and growing) feature list ◦ Include a Front Controller ◦ Action classes and mappings ◦ Utility classes for XML ◦ Automatic population of server-side JavaBeans ◦ Web forms with validation ◦ Internationalization support.
  • 17.
    Web Application Frameworks JavaServerFaces ◦ a Java specification for building component-based user interfaces for web applications and was formalized as a standard through the Java Community Process being part of the Java Platform, Enterprise Edition. ◦ Only for presenting user interface ◦ Support internationalization ◦ Validation ◦ multiple client types, and accessibility ◦ Standardization of the architecture and API will allow tool interoperation and the development of portable, reusable Web-tier GUI component libraries.
  • 18.
    Benefits of MVC Decouplespresentation and logic into separate components Separates developer roles Provides a central point of control Facilitates unit testing and maintenance Can be purchased instead of built Provides a rich set of features Encourages the development and use of standardized components Provides stability Has community support