80 likes | 452 Views
3-Tier Web Application Architecture. HTTP request Name/Value pairs. HTTP response HTML/XML/XSLT. Client. App Server. Simple Log-in. public String button1_action() { // TODO: Process the button click action. Return value is a navigation
E N D
HTTP request Name/Value pairs HTTP response HTML/XML/XSLT Client App Server Simple Log-in public String button1_action() { // TODO: Process the button click action. Return value is a navigation // case name where null will return to the same page. if (textField1.getText().toString().equalsIgnoreCase("itkstu") && textField2.getText().toString().equals("student")) return "OK"; else return "NotOK"; Don’t do this here! (Why?)
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
SQL Result set App. Server HTTP request Name/Value pairs Client Tier 2 (Domain Layer) Database Server Tier 1 (View Layer) Tier 3 (Data Layer) HTTP response HTML/XML/XSLT Using Beans Bean / Business Logic (Getters & Setters) + Servlets/JSP/JSF/ VB.NET/Perl (Dynamic Content) HTML, CSS, JS, Applet (Static Content) +
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 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 From Object-Oriented Analysis and Design and the Unified Process