3 Tier Web Application Architecture Simple Login HTTP
3 -Tier Web Application Architecture
Simple Log-in HTTP request Name/Value pairs Client HTTP response HTML/XSLT App Server public String button 1_action() { // TODO: Process the button click action. Return value is a navigation // case name where null will return to the same page. if (text. Field 1. get. Text(). to. String(). equals. Ignore. Case("itkstu") && text. Field 2. get. Text(). to. String(). equals("student")) Don’t do this here! return "OK"; (Why? ) else return "Not. OK";
Why do we need Beans? • Things generally are not so simple (thus, should not be hard-coded) • Generally database access is required • Bean contains the business logic • (Data access) bean acts as a bridge between GUI and DB in the middle tier
Using Beans SQL App. Server Client Tier 1 (View Layer) HTTP request Name/Value pairs Tier 2 (Domain Layer) Result set Database Server HTTP response HTML/XSLT Bean / Business Logic (Getters & Setters) + Servlets/JSP/JSF/ HTML, CSS, JS, Applet + VB. NET/Perl (Static Content) (Dynamic Content) Tier 3 (Data Layer)
Object Responsibilities • View Layer – Display electronic forms and reports – Capture input (events) – Displays data fields – Accept input data – Edit and validate input data – Forward input data to the domain layer classes – Startup and shutdown the system 5 From Object-Oriented Analysis and Design and the Unified Process
Object Responsibilities (cont’d) • Domain Layer – Create domain (persistent) classes – Process all business rules – Prepare persistent classes for storage to the DB • Data Access Layer – Establish and maintain DB connection – Contain all SQL statements – Process result sets into appropriate domain classes – Disconnect gracefully from the DB 6 From Object-Oriented Analysis and Design and the Unified Process
- Slides: 6