Expert One-on-One J2EE Design and Development



Similar documents
How to Build an E-Commerce Application using J2EE. Carol McDonald Code Camp Engineer

White Paper: 1) Architecture Objectives: The primary objective of this architecture is to meet the. 2) Architecture Explanation

JAVA ENTERPRISE IN A NUTSHELL. Jim Farley and William Crawford. O'REILLY 4 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo.

Contents. Client-server and multi-tier architectures. The Java 2 Enterprise Edition (J2EE) platform

Core Java+ J2EE+Struts+Hibernate+Spring

Distributed Objects and Components

IBM WebSphere Server Administration

SOA REFERENCE ARCHITECTURE: WEB TIER

Oracle WebLogic Foundation of Oracle Fusion Middleware. Lawrence Manickam Toyork Systems Inc

Oracle WebLogic Server 11g Administration

Internet Engineering: Web Application Architecture. Ali Kamandi Sharif University of Technology Fall 2007

WebSphere Server Administration Course

Expert Spring MVC and Web Flow

Mastering Tomcat Development

Core J2EE Patterns, Frameworks and Micro Architectures

Japan Communication India Skill Development Center

A standards-based approach to application integration

Enterprise JavaBeans 3.1

Stock Trader System. Architecture Description

Course Name: Course in JSP Course Code: P5

Introduction to Sun ONE Application Server 7

WebSphere Training Outline

Chapter 4. Architecture. Table of Contents. J2EE Technology Application Servers. Application Models

Complete Java Web Development

Client-Server Architecture & J2EE Platform Technologies Overview Ahmed K. Ezzat

CHAPTER 1 - JAVA EE OVERVIEW FOR ADMINISTRATORS

Japan Communication India Skill Development Center

What Is the Java TM 2 Platform, Enterprise Edition?

HPC Portal Development Platform with E-Business and HPC Portlets

This training is targeted at System Administrators and developers wanting to understand more about administering a WebLogic instance.

JBS-102: Jboss Application Server Administration. Course Length: 4 days

Course Description. Course Audience. Course Outline. Course Page - Page 1 of 5

Java EE Web Development Course Program

Java EE 7: Back-End Server Application Development

Oracle WebLogic Server 11g: Administration Essentials

2012 LABVANTAGE Solutions, Inc. All Rights Reserved.

Learn Oracle WebLogic Server 12c Administration For Middleware Administrators

Net-WMS FP Net-WMS SPECIFIC TARGETED RESEARCH OR INNOVATION PROJECT. Networked Businesses. D.8.1 Networked architecture J2EE compliant

Building Web Applications, Servlets, JSP and JDBC

MVC pattern in java web programming

Japan Communication India Skill Development Center

zen Platform technical white paper

25 May Code 3C3 Peeling the Layers of the 'Performance Onion John Murphy, Andrew Lee and Liam Murphy

No.1 IT Online training institute from Hyderabad URL: sriramtechnologies.com

Enterprise Application Development Using UML, Java Technology and XML

CrownPeak Java Web Hosting. Version 0.20

Architectural Overview

OUR COURSES 19 November All prices are per person in Swedish Krona. Solid Beans AB Kungsgatan Göteborg Sweden

Oracle WebLogic Server

COM 440 Distributed Systems Project List Summary

NetBeans IDE Field Guide

MagDiSoft Web Solutions Office No. 102, Bramha Majestic, NIBM Road Kondhwa, Pune Tel: /

How To Develop A Web Service In A Microsoft J2Ee (Java) 2.5 (Oracle) 2-Year Old (Orcient) 2Dj (Oracles) 2E (Orca) 2Gj (J

Cocoon 2 Programming: Web Publishing with XML and Java"

Framework Adoption for Java Enterprise Application Development

Customer Bank Account Management System Technical Specification Document

Virtual Credit Card Processing System

CACHÉ: FLEXIBLE, HIGH-PERFORMANCE PERSISTENCE FOR JAVA APPLICATIONS

Course Number: IAC-SOFT-WDAD Web Design and Application Development

Beginning POJOs. From Novice to Professional. Brian Sam-Bodden

Chapter 2 TOPOLOGY SELECTION. SYS-ED/ Computer Education Techniques, Inc.

JReport Server Deployment Scenarios

HPC PORTAL DEVELOPMENT PLATFORM

JAVA/J2EE DEVELOPER RESUME

Client/server is a network architecture that divides functions into client and server

Enterprise Applications

Enterprise Application Integration

EJB & J2EE. Component Technology with thanks to Jim Dowling. Components. Problems with Previous Paradigms. What EJB Accomplishes

Glassfish, JAVA EE, Servlets, JSP, EJB

Deploying Rule Applications

JBOSS ENTERPRISE APPLICATION PLATFORM MIGRATION GUIDELINES

WebLogic Server 11g Administration Handbook

JEE Web Applications Jeff Zhuk

OptimalJ Foundation. PSM EJB Model. Roadmap. What is the EJB model? EJB model as a PSM model Mapping the EJB model Model elements and code generation

Winning the J2EE Performance Game Presented to: JAVA User Group-Minnesota

1 What Are Web Services?

SAP Web Application Server 6.30: Learning Map for Development Consultants

Techniques for Scaling Components of Web Application

Business Process Execution Language for Web Services

Oracle WebLogic Server 11g: Monitor and Tune Performance

WEB APPLICATION DEVELOPMENT. UNIT I J2EE Platform 9

Patterns of Enterprise Application Architecture

Communiqué 4. Standardized Global Content Management. Designed for World s Leading Enterprises. Industry Leading Products & Platform

How To Write A Web Framework In Java

WebSphere ESB Best Practices

1 What Are Web Services?

JSLEE and SIP-Servlets Interoperability with Mobicents Communication Platform

The TransactionVision Solution

Developing Web Services with Documentum

Oracle Weblogic. Setup, Configuration, Tuning, and Considerations. Presented by: Michael Hogan Sr. Technical Consultant at Enkitec

enterprise^ IBM WebSphere Application Server v7.0 Security "publishing Secure your WebSphere applications with Java EE and JAAS security standards

Oracle Identity Analytics Architecture. An Oracle White Paper July 2010

How To Protect Your Computer From Being Hacked On A J2Ee Application (J2Ee) On A Pc Or Macbook Or Macintosh (Jvee) On An Ipo (J 2Ee) (Jpe) On Pc Or

Overview Document Framework Version 1.0 December 12, 2005

Transcription:

Expert One-on-One J2EE Design and Development Rod Johnson wrox Programmer to Programmer ULB Darmstadt

Introduction 1 J2EE Myths 2 How is this Book Different? 5 My Approach 6 Who this Book is for 7 Aims of this Book 7 What this Book Covers 7 Assumed Knowledge 8 Recommended Reading 9 What You Need to Use this Book 9 Chapter 1: J2EE Architectures 15 Goals of an Enterprise Architecture 16 Deciding Whether to Use a Distributed Architecture 18 New Considerations in J2EE Design 19 When to Use EJB 20 Implications of Using EJB 20 Questionable Arguments for Using EJB 22 Compelling Arguments for Using EJB 22 Arguments for Using EJB to Consider on a Case-by-Case Basis 23 Accessing Data 24 J2EE Data Access Shibboleths 24 Entity Beans 25 Java Data Objects (JDO) 25 Other 0/R Mapping Solutions * 25 JDBC 26 State Management 26 J2EE Architectures 26 Common Concepts 27 Architectural Tiers in J2EE Applications 27 The Importance of Business Interfaces 28

Non-distributed Architectures 28 Web Application with Business Component Interfaces 28 Web Application that Accesses Local EJBs 30 Distributed Architectures 32 Distributed Application with Remote EJBs 32 Web Application Exposing Web Services Interface 34 Web Tier Design 36 The Model View Controller (MVC) Architectural Pattern 36 Connectivity Between the Web Tier and Business Objects 38 Designing Applications for Portability 38 Summary 40 Chapter 2 J2EE Projects: Choices and Risks 43 Developing a Policy on Specification Versions 44 Choosing an Application Server 45 When to Choose an Application Server 46 Defining the Requirements 47 Evaluation Criteria 48 Supported Specifications 48 Sun Resources 48 Cost 50 Vendor Relationship 50 Vendor Viability 51 Development and Deployment 51 Value-added Features 52 Quality of Documentation 52 Availability of Skills 53 User Experience 53 Choice Process 54 Top Mistakes in Choosing an Application Server 54 The "Neat Technology" Trap 55 When to Use Alternative Technologies to Supplement J2EE 56 Portability Issues 56 What does Portability Mean? 57 A Pragmatic Approach to Portability 58 Staging Environments and Release Management 58 Building a Team 60 Team Structure - 60 Who Owns the Architecture? 60 Vertical or Horizontal Responsibility 61

Choosing Development Tools 63 Visual Modeling Tools 64 IDEs 64 Build Utilities 64 Code Generators 66 Version Control 67 Identifying and Mitigating Risks 67 Summary 71 Chapter 3: Testing J2EE Applications 73 What Can Testing Achieve? 74 Definitions 75 Testing Correctness 76 The XP Approach to Testing 76 Writing Test Cases 78 What Makes a Good Test Case? 78 Recognizing Test Case Authoring and Maintenance as a Core Task 78 Unit Testing 78 main() Methods 79 Using JUnit ' 79 Test Practices 86 Should Testing Strategy Affect How We Write Code? 90 Integration and Acceptance Testing 92 Testing Business Objects 92 Testing Business Objects Implemented Without Using EJB 92 Testing EJBs 93 Testing Database Interaction 99 Testing Web Interfaces 100 Unit Testing Web-Tier Components 101 Acceptance Testing Web Interfaces 104 Design Implications 105 Testing Performance and Scalability 105 Load Testing EJBs and Other Business Objects 106 Load Testing Web Interfaces 107 Automating Tests 107 Complementary Approaches to Testing 108 Summary 110 m

Chapter 4: Design Techniques and Coding Standards for J2EE Projects 113 00 Design Recommendations for J2EE Applications 114 Achieving Loose Coupling with Interfaces 115 Prefer Object Composition to Concrete Inheritance 115 The Template Method Design Pattern 117 The Strategy Design Pattern 119 Using Callbacks to Achieve Extensibility 120 The Observer Design Pattern 122 Consider Consolidating Method Parameters 124 Exception Handling - Checked or Unchecked Exceptions 125 Good Exception Handling Practices 128 Exceptions in J2EE 130 Making Exceptions Informative 131 Using Reflection 132 Reflection Idioms 133 Using JavaBeans to Achieve Flexibility 138 Avoid a Proliferation of Singletons by Using an Application Registry 139 Refactoring 142 Coding Standards 142 Start from the Standard 143 Allocation of Responsibilities 145 Avoid Code Duplication 146 Avoid Literal Constants 147 Visibility and Scoping 149 Public Instance Variables 149 Protected and Package Protected Instance Variables 150 Method Visibility 151 Variable Scoping 151 Inner Classes and Interfaces 152 Using the final Keyword 153 Method Overriding and Final Methods 153 Final Classes 155 Final Instance Variables 155 Implementing tostringo Methods Useful for Diagnostics 155 Defensive Coding Practices 156 Handle Nulls Correctly 156 Consider the Ordering of Object Comparisons 156 Use Short-circuit Evaluation 157 Distinguish Whitespace in Debug Statements and Error Messages 157 Prefer Arrays to Collections in Public Method Signatures 157 Documenting Code 158 Logging 160 Choosing a Logging API 162 Logging in the EJB Tier 165 iv

Why (and How) Not to Reinvent the Wheel 166 Help! API Overload 167 Using Frameworks 167 What Makes a Good Framework? 168 Benefits of Using Existing Frameworks 168 Evaluating Existing Frameworks 169 Implementing your own Framework 170 Summary 171 Chapter 5: Reauirements for the Sample Application 179 Overview 180 User Populations 180 Public Internet Users 180 Box Office Users 181 Administrators 182 Assumptions 182 Scope Limitations 183 Delivery Schedule 183 Internet User Interface 183 Basic Workflow 184 Error Handling 185 Application Screens 185 Welcome Screen 188 Display Show Screen 189 Book Seats Screen 191 Show Reservation Screen 192 Payment Details Screen 194 Confirm Reservation Screen 196 Box Office User Interface 198 Non-Functional Requirements 198 Hardware and Software Environment 199 Summary 200 Chapter 6: Applying J2EE Technologies 203 When Is a Distributed Architecture Appropriate?. 204 Distributed Applications and Scalability 205 Distributed Applications and Reliability 206 Scalable and Robust Architectures 207 High-level Architecture for the Sample Application 209

Deciding When to Use EJB 209 Using EJB to Implement a Distributed Architecture 209 Transaction Management 210 Transaction Management in J2EE Applications 210 Transaction Management and EJB 211 Transaction Management in the Sample Application 213 EJB and Authorization 213 EJB and Multi-threading 214 Declarative Configuration Management 214 The Downside of EJB 214 So Much Infrastructure 214 Programming Restrictions Applying to EJBs 215 The Singleton Problem in EJB 220 Timer Functionality 222 EJBs in the Sample Application 222 Deciding How to Use EJB 223 What Should EJBs Do? 223 When to Use Local or Remote Interfaces 223 Does it Make Sense for a Bean to Have Both Local and Remote Interfaces? 224 Phony Remote Interfaces 225 EJB Interface Summary 226 Using EJBs in the Sample Application 227 Deciding when to Use Asynchronous Calling with JMS 228 Message-Oriented Middleware (MOM) and JMS 228 Producing Messages 228 Consuming Messages 229 Consuming Messages without Using EJB 229 Consuming Messages with Message-Driven Beans (MDB) 229 When to Use Asynchronous Calling 232 Indications for Using Messaging 232 Disadvantages of Using Messaging 233 JMS and Performance 233 Alternatives to JMS Messaging 234 JMS in the Sample Application 234 Authentication and Authorization 235 The Standard Security Infrastructure 235 The Server Implementation 237 Deciding When to Use XML 238 Using XSLT in J2EE Applications 238 "Deep" Use of XML 239 Converting Between JavaBeans and XML 241 J2EE and XML in the Future 244 XML in the Sample Application, 245 Caching to Improve Performance 245 Caching Options 245 A Caching Strategy for the Sample Application 247 Summary 248 Vl

Chapter 7: Data Access In J2EE Applications 251 Data Access Goals 252 Business Logic and Persistence Logic 252 Object-Driven and Database-Driven IVIodeiing: A Philosophical Debate 253 O/R Mapping and the "Impedance Mismatch" 255 The Data Access Object (DAO) Pattern 257 Working with Relational Databases 259 Referential Integrity 259 Stored Procedures, Triggers, and Views 259 RDBMS Performance Issues 262 RDBMS Performance Tuning 262 Denormalization 263 Portability Versus Performance 263 Exchanging Data In Distributed Applications 265 The Value Object J2EE Pattern 265 "Generic" Value Objects 267 "Disconnected" Data Access Using JDBC Rowsets 267 Common Data Access Issues 268 Transaction Isolation 268 Pessimistic and Optimistic Locking 269 Primary Key Generation Strategies 269 Sequence Entity Bean 271 Unique ID Generation in Java 271 Database-Specific ID Generation 271 JDBC 3.0 273 Where to Perform Data Access 273 Data Access in the EJB Tier 273 Entity EJBs 274 Session EJBs and Helper Classes 275 Data Access in the Middle Tier without Using EJB 275 Data Access in the Web Tier 276 Servlets and Web-Specific Classes 276 Data Access from JSP Pages 276 Summary 278 Data Modeling in the Sample Application 278 Vll

Chapter 8: Data Access Using Entity Beans 285 Entity Bean Concepts 286 Definition 287 How Should We Use Entity Beans? 288 The Granularity Debate 288 The Business Logic Debate 290 Session Beans as Mediators 291 CMP Versus BMP 292 Entity Beans in EJB 2.0 294 Local Interfaces 294 Home Interface Business Methods 295 EJB 2.0 CMP 296 Basic Concepts 296 Container-Managed Relationships (CMR) 297 EJB QL 298 Limitations of O/R Modeling with EJB 2.0 Entities 299 Custom Entity Behavior with CMP/BMP Hybrids 299 Entity Bean Caching 300 Entity Bean Locking Strategies 301 Exclusive Locking 301 Database Locking. 302 Read-only and "Read-mostly" Entities 302 Transactional Entity Caching 304 Entity Bean Performance 305 Tool Support for Entity Beans 306 Summary 306 Chapter 9: Practical Data Access 311 Data Access Technology Choices 312 SQL-Based Technologies 312 JDBC 312 SQU 313 0/R Mapping Technologies 315 Established Commercial Products 315 Java Data Objects (JDO) 317 Choosing a Data Access Strategy for the Sample Application 319 JDBC Subtleties 320 Correct Exception Handling t 320 Extracting Information from SQLExceptions 322 The PreparedStatement Question 323 viii

r Table of Contents A Generic JDBC Abstraction Framework 324 Motivation 325 Aims 326 Exception Handling 327 A Generic Data-Access Exception Hierarchy 328 Converting JDBC Exceptions to Generic Exceptions 331 Two Levels of Abstraction 333 A Framework to Control JDBC Workflow and Error Handling 333 "Inversion of Control" Revisited 334 The com.interface21.jdbc.core package 334 Using the JdbcTemplate Class 340 A Higher Level of Abstraction: Modeling RDBMS Operations as Java Objects 342 Implementation of the com.interface21.jdbc.object Package 342 Using the JDBC Object Abstraction 347 JDBC Abstraction Summary > 351 Implementing the DAO Pattern in the Sample Application 353 Summary 360 Chapter 10: Session Beans 363 Using Stateless Session Beans 364 Benefits of Stateless Session Beans 364 Stateless Session Beans and Internal State 365 Implications of Stateless Session Bean Pooling 365 Using Stateful Session Beans 366 Why Not to Use Stateful Session Beans 366 Performance and Scalability Issues 366 Reliability Issues 368 When to Use Stateful Session Beans 370 Session Synchronization 370 Protecting Stateful Session Beans from Concurrent Calls 371 Patterns for Achieving Stateful Functionality with SLSBs 371 Object Parameter 372 Using a "Required Workflow Exception" to Mimic an SFSB State Machine 372 Using a Stateful Session Bean as Controller 373 J2EE Design Patterns Applicable to Session Beans 373 The Session Facade Pattern in Distributed J2EE Applications 374 The EJB Command Design Pattern 374 Implementing the EJB Command Design Pattern 375 Advantages and Disadvantages of the EJB Command Design Pattern 377 Using Commands without Adopting the Command Design Pattern 378 Session Bean Implementation Issues " 379 Error Handling in EJBs 379 The EJB Container's Behavior on Exceptions 380 Understanding EJB API Exceptions 381 Transaction Attributes for EJBs using CMT 382 The Business Methods Interface "Pattern" 386 ix

Session Beans in the Sample Application 389 Summary 389 phapter 11; Infrastructure and Application Implementation 393 Infrastructure 394 Goals of a Strong Infrastructure 395 Using a Framework to Configure Application Components 396 The Problem 396 Using JavaBeans 397 Using a "Bean Factory" 401 The Application Context 406 Testing Implications 408 Summary of Application Configuration Infrastructure 409 Managing API Complexity 410 Implementing EJBs 410 Accessing EJBs 417 Using JMS 425 Implementing Business Logic 428 Implementing the Sample Application 428 Defining Business Interfaces 429 Determining Implementation Strategy. 432 Implementing the BoxOffice 433 Using JMS to Propagate Data Updates 435 Pulling It All Together 436 Summary 437 Chapter 12: Web-Tier MVC Design 441 The Challenges of Web Development 442 Lessons Learned in Java Web Development 443 The Shortcomings of Servlet-only Solutions 443 JSP: Promise and Temptation 444 "JSP Model 1" Architecture 444 The Temptation of the JSP Standard Infrastructure 445 Striking a Balance 446 Web-Tier Design Goals 447 A Clean Web Tier 447 A Thin Web Tier 447 MVC Concepts and the Front Controller J2EE Pattern, 448 Concepts 449 The MVC Triad 449 Control Row 452

Pattern Variants 453 Template Selection Servlet 453 How Many Controller Sen/lets? 454 JSP or Servlet Controller? 454 Should a Request Cause the Creation of a Command? 455 Implementation Goals 455 Web Application Frameworks 456 Common Concepts 456 Available Frameworks 457 Struts 457 Maverick 461 WebWork 463 Integrating a Web Appiication Framework Into Overall Application Architecture 465 The Web Application Framework Used In the Sample Application 467 Design Goals 468 Basic MVC Control Row 469 Controller Servlet 471 Request to Controller Mapping (com.interface21.web.servlet.handlermapping) 473 Request Controller (com.interface21.web.servlet.mvc.controller) 474 Models 475 Views 476 ViewResolver 477 ContextLoaderServlet, 478 Custom Tags 479 Workflow Refinements 479 Examples 480 A Basic Controller Implementation 481 A Controller Exposing Bean Properties 482 A Multi-Action Controller 484 Web-Tier Session Management 488 Session State Managed by the J2EE Server 488 Clustering and Replication 488 Simple Optimizations 489 Session State Held in the Browser 490 Session State Management with Cookies 490 Session State Management with Hidden Form Fields 491 Processing User Input 492 Data Binding and Displaying Input Errors for Resubmission 492 Approaches to Data Binding in MVC Frameworks 493 JSP Custom Tags 494 Data Validation 496 Where Should Data Validation be Performed? 496 Data Validation in the Framework Described in this Chapter 498 Implementing the Web Tier In the Sample Application 506 Overview 506 Handling a Seat Reservation Request 508 Implementation Review 511 Summary 512 Xl

Chanter 12: Views In the Web Tier 515 Decoupling Controllers and Views 517 Constructing the View for the Reservations Page 519 Information Presented and Required Formatting 519 The Model Behind this View 521 Model Principles 524 JSP Views 526 What We Want to Avoid 527 How to Use JavaBeans in JSP Pages 531 JSP Custom Tags 532 The Java Standard Tag Library 533 Other Third-Party Tag Libraries 535 Implementing Your Own Tag Libraries 535 Guidelines for Custom Tag Use 536 Guidelines for JSP Use 536 Looking Ahead: Implications of JSP 2.0 538 A JSP View for the Example 538 JSP Summary 543 Dedicated Template Languages 544 Common Concepts 544 WebMacro. 545 Velocity 546 Velocity Concepts 546 A Velocity Template for our Example 548 Velocity Summary 550 FreeMarker 551 XSLT 551 When to Use XSLT 552 What Do We Want from XSL? 553 How to Use XSLT in Views 553 Using XSLT Instead of JSP 553 Using XSLT from JSP Custom Tags 554 Implementing our Example Using a "Pure" XSLT Approach 555 Alternative Approaches to Markup Generation 561 HTML Generation Libraries 562 XMLC 563 An XMLC Template for Our Example 564 Compiling the Template 567 Manipulating the XMLC Object Generated from the Template 568 Further Reading on XMLC 570 Generating Binary Content - 571 Generating PDF with itext 571 View Composition and Page Layout 575 Summary 579 xii

Chapter 14: Packaging and Application Deployment 583 Packaging Deployment Units Expanded Deployment Units Understanding J2EE Class Loading Java Class Loading Concepts Class Loading in J2EE Server Check List Recommendations Further Information Packaging the Sample Application Application Deployment: Common Concepts Configuring a Server to Run the Application Creating Connection Pools Creating JMS Destinations Setting up Authentication Installing Libraries Writing Proprietary Deployment Descriptors for an Application EJB-Specific Configuration Web-Tier Configuration Deploying an Application Deployment Parameters for the Sample Application Deploying the Sample Application on JBoss 3.0 Understanding the JBoss Directory Structure Configuring a JBoss Server to Run the Sample Application Creating a Connection Pool Creating JMS Destinations Installing the Service Definition File Reviewing Configuration Writing JBoss Deployment Descriptors for the Sample Application Deploying the Application Summary 584 584 585 585 585 586 590 591 592 592 596 596 597 597 597 598 598 599 599 600 600 601 601 602 602 603 604 604 605 607 608 Chapter 15: Performance Testing and Tuning an Application 611 Strategic Issues and Definitions Performance and Scalability Setting Clear Goals for Performance and Scalability Design Versus Code Optimization Tools for Testing Performance and Throughput Preparing to Benchmark Web Test Tools Microsoft Web Application Stress Tool Non-Web Testing Tools 612 613 614 614 615 616 617 617 619 xiii

Locating Performance or Scalability Problems Testing in Layers Profiling Tools JVM Profiling Options The JProbe Profiler Addressing Performance or Scalability Problems Server Choice and Server Configuration Dispensing with Redundant Container Services Caching When to Cache Where to Cache Third-party Caching Products for Use in J2EE Applications Code Optimization Case Study: The "Display Show" Page In the Sample Application Performance in Distributed Applications The Overhead of Remote Method Invocation (RMI) Minimizing Remote Calls Application Partitioning Consolidating Remote Calls Moving Data Efficiently Serialization Optimizations Other Data Transfer Strategies Collocating Components in the Same JVM Web-Tier Performance Issues View Performance Web Caching Using HTTP Capabilities Cache Control HTTP Headers Using the Servlet API to Control Caching Implications for MVC Web Applications The Welcome Page in the Sample Application Edged Side Caching and ESI The Primary Causes of Performance and Scalability Problems in J2EE Applications Summary 622 623 623 624 625 630 630 631 632 632 633 637 638 643 653 653 655 655 658 658 659 662 663 663 663 666 666 668 669 670 671 672 673 Chapter 16: Conclusion: Making J2EE Work for You 675 General Principles Projects 676 679 Appendix A: Implementing View Technologies 683 Decoupling Controllers from View Technologies Using a View Interface View Implementations 684 686 xlv

JSP Configuring the JSTL The InternalResourceView View Implementation Defining JSP Views for Use in an Application Velocity Installing and Configuring Velocity Implementing the View Interface for Velocity Exposing Model Data to a Velocity Template Providing Support for Date and Currency Formatting Defining Velocity Views for Use in an Application XSLT Installing Domify Implementing the View Interface for XSLT Performing XSLT transforms Date and Currency Formatting Support Defining XSLT Views for Use in an Application XMLC Installing and Configuring XMLC Implementing the View Interface for XMLC Defining XMLC Views for Use in an Application Generating PDF with IText Installing itext Implementing the View Interface for PDF Generation with itext Defining PDF Views for Use in an Application Additional Views Custom Views Index 711 688 688 689 691 691 691 692 693 694 695 696 696 697 697 700 701 703 703 704 705 705 705 705 707 707 708 XV