100% found this document useful (1 vote)
10 views

Websphere Studio Application Developer Version 5 Programming Guide Programming Guide 1st Edition Ibm Redbooks 2024 scribd download

Application

Uploaded by

sixtasurry5j
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
10 views

Websphere Studio Application Developer Version 5 Programming Guide Programming Guide 1st Edition Ibm Redbooks 2024 scribd download

Application

Uploaded by

sixtasurry5j
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Visit https://ebookfinal.

com to download the full version and


explore more ebook

Websphere Studio Application Developer Version 5


Programming Guide Programming Guide 1st Edition Ibm
Redbooks

_____ Click the link below to download _____


https://ebookfinal.com/download/websphere-studio-
application-developer-version-5-programming-guide-
programming-guide-1st-edition-ibm-redbooks/

Explore and download more ebook at ebookfinal.com


Here are some recommended products that might interest you.
You can download now and explore!

Websphere J2ee Application Development for the IBM Server


Iseries Server 1st ed Edition Ibm Redbooks

https://ebookfinal.com/download/websphere-j2ee-application-
development-for-the-ibm-server-iseries-server-1st-ed-edition-ibm-
redbooks/
ebookfinal.com

An EAI solution using WebSphere Business Integration 1st


ed Edition Ibm Redbooks

https://ebookfinal.com/download/an-eai-solution-using-websphere-
business-integration-1st-ed-edition-ibm-redbooks/

ebookfinal.com

IBM Certification Study Guide AIX Problem Determination


Tools and Techniques 1st Edition Ibm Redbooks

https://ebookfinal.com/download/ibm-certification-study-guide-aix-
problem-determination-tools-and-techniques-1st-edition-ibm-redbooks/

ebookfinal.com

Systems programmer s guide to z OS System Logger 1st ed


Edition Ibm Redbooks

https://ebookfinal.com/download/systems-programmer-s-guide-to-z-os-
system-logger-1st-ed-edition-ibm-redbooks/

ebookfinal.com
Maple 9 advanced programming guide 1st Edition Monagan

https://ebookfinal.com/download/maple-9-advanced-programming-
guide-1st-edition-monagan/

ebookfinal.com

WebSphere Application Server Express V6 developers guide


and development examples 1st ed Edition Bill Moore

https://ebookfinal.com/download/websphere-application-server-
express-v6-developers-guide-and-development-examples-1st-ed-edition-
bill-moore/
ebookfinal.com

CNC programming handbook a comprehensive guide to


practical CNC programming 3rd ed Edition Smid

https://ebookfinal.com/download/cnc-programming-handbook-a-
comprehensive-guide-to-practical-cnc-programming-3rd-ed-edition-smid/

ebookfinal.com

Programming Java 2 micro edition on Symbian OS a developer


s guide to MIDP 2 0 Martin De Jode

https://ebookfinal.com/download/programming-java-2-micro-edition-on-
symbian-os-a-developer-s-guide-to-midp-2-0-martin-de-jode/

ebookfinal.com

IBM WebSphere DataPower SOA appliance handbook 1st Edition


Bill Hines

https://ebookfinal.com/download/ibm-websphere-datapower-soa-appliance-
handbook-1st-edition-bill-hines/

ebookfinal.com
Websphere Studio Application Developer Version 5
Programming Guide Programming Guide 1st Edition
Ibm Redbooks Digital Instant Download
Author(s): IBM Redbooks, Ueli Wahli, International Business Machines
Corporation
ISBN(s): 9780738499574, 0738499579
Edition: 1
File Details: PDF, 11.14 MB
Year: 2003
Language: english
Front cover

WebSphere Studio
Application Developer
Version 5 Programming Guide
Develop Java, Web, XML, database, EJB,
and Web services applications

Test with built-in and remote


servers

Deploy to WebSphere
Application Server

Ueli Wahli
Ian Brown
Fabio Ferraz
Maik Schumacher
Henrik Sjostrand

ibm.com/redbooks
International Technical Support Organization

WebSphere Studio Application Developer Version 5


Programming Guide

July 2003

SG24-6957-00
Note: Before using this information and the product it supports, read the information in
“Notices” on page xix.

First Edition (July 2003)

This edition applies to Version 5 of WebSphere Studio Application Developer and WebSphere
Application Server.

This book is a rewrite of the IBM Redbook, WebSphere Studio Application Developer
Programming Guide, SG24-6585, which was based on Version 4 of the products.

© Copyright International Business Machines Corporation 2003. All rights reserved.


Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP
Schedule Contract with IBM Corp.
Contents

Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
The team that wrote this redbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
Become a published author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Comments welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiv
Summary of changes from SG24-6585 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
July 2003, First Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv

Part 1. Introducing WebSphere Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Chapter 1. Introduction and concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3


Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Platform architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Workbench features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Plug-in based tooling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Role-oriented development with consistent look and feel . . . . . . . . . . . . . . . 7
Vertical and horizontal integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Open standards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Open team development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
File-based IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
WebSphere Studio products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
What is new in Application Developer Version 5 . . . . . . . . . . . . . . . . . . . . . . . 11
Migration from previous versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Web development tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Relational database tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
XML tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Java development tools (JDT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Web services development tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
EJB development tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Team collaboration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Debugging tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Performance profiling tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Server tools for testing and deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Plug-in development tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Sample code in this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

© Copyright IBM Corp. 2003. All rights reserved. iii


EJBBANK database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Naming convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Chapter 2. Setting up your Workbench and workspace preferences . . . . 21


Workbench basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Workspace basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Application Developer’s log files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Automatic builds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
File associations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Local history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Perspectives preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Internet preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Java development preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Java classpath variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Appearance of Java elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Code formatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Compiler options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Java Editor settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Installed JREs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Javadoc documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Organize imports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

Chapter 3. Perspectives, views, and editors. . . . . . . . . . . . . . . . . . . . . . . . 47


Integrated development environment (IDE) . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Application Developer help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Perspectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Perspective layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Switching perspectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Specifying the default perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Organizing and customizing perspectives. . . . . . . . . . . . . . . . . . . . . . . . . . 54
Perspectives walkthrough . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
J2EE perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Resource perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Web perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Java perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Java Browsing perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

iv WebSphere Studio Application Developer Version 5 Programming Guide


Java Type Hierarchy perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Server perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
XML perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
XSL Debug perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Data perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Debug perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Profiling perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Component Test perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
CVS Repository Exploring perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Install/Update perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Plug-in Development perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

Chapter 4. Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
J2EE architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Web containers and EJB containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
EAR files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
WAR files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
JAR files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Projects and folders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Application Developer’s project types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Simple project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Java project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Enterprise Application project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Web project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
EJB project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Application Client project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Server project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Creating a new project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Project properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Using templates to create application projects . . . . . . . . . . . . . . . . . . . . . . . . . 88
Running the Application Template Wizard . . . . . . . . . . . . . . . . . . . . . . . . . 88
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

Part 2. Developing applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

Chapter 5. Developing Java applications . . . . . . . . . . . . . . . . . . . . . . . . . . 93


Creating and working with a Java project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Creating a Java project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Creating Java packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Creating Java classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Running your programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Exporting code and running outside Application Developer . . . . . . . . . . . 106
Locating compile errors in your code . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

Contents v
Debugging your code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Preparing a utility project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Banking model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Importing the implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Testing the model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Programming assists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Pluggable JDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Java Scrapbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Code assist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Navigating through your code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Import generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Tasks view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Code generation actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Smart compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Java search and working sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Bookmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Javadoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Generating Javadoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Using Ant to generate Javadoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

Chapter 6. Developing database applications . . . . . . . . . . . . . . . . . . . . . 139


JDBC overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Data source versus direct connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Application Developer database operations . . . . . . . . . . . . . . . . . . . . . . . . . . 142
XMI and DDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Data perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
DB Servers view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Data Definition view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Navigator view. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Using the DB Servers view. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Creating a database connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Importing database objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Generate DDL and XML schema files. . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Creating database objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Create database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Create schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Create table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Create table with foreign key. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Define the database schema in a database system . . . . . . . . . . . . . . . . . 163

vi WebSphere Studio Application Developer Version 5 Programming Guide


Creating SQL statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Using the SQL Statement Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Using SQL Query Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Accessing databases from a Java application . . . . . . . . . . . . . . . . . . . . . . . . 174
Access using the DriverManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Access using a data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
J2EE client application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

Chapter 7. Developing Web applications . . . . . . . . . . . . . . . . . . . . . . . . . 179


Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Sample application: RedBank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Controller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Facade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Application flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Creating a Web project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Adding the banking model as a utility JAR . . . . . . . . . . . . . . . . . . . . . . . . 188
Module dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Project properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Web project directory structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Importing existing resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Creating static Web resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Create a simple HTML page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Using the Page Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Using the CSS Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Creating dynamic Web resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Working with servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Working with JSPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Creating a server for testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Testing the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Working with filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Creating a filter in Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . 227
Editing the filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Working with listeners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Creating a listener in Application Developer . . . . . . . . . . . . . . . . . . . . . . . 233
Editing the listener. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Creating Web pages from a JavaBean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Completing the code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Tailoring the generated files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Running the generated application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

Contents vii
Chapter 8. Developing Web applications with database access . . . . . . 247
Accessing databases from a Web application . . . . . . . . . . . . . . . . . . . . . . . . 248
Creating a Web project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Generate Web pages from SQL queries . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Defining a data source in the server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Testing the database application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Accessing a database using DB Beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Creating a JSP using DB Beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Accessing a database using JSP taglib . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

Chapter 9. Developing applications with stored procedures . . . . . . . . . 271


What is a stored procedure? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Creating a Java stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Importing the database definition into a Web project . . . . . . . . . . . . . . . . 272
Using the Stored Procedure Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Building the stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Executing the stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Accessing a Java stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Using a main program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Generate a JavaBean to access the stored procedure . . . . . . . . . . . . . . . 281
Using the JSP tag library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Generate JavaBean Web pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Creating a stored procedure with multiple statements . . . . . . . . . . . . . . . . . . 287
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

Chapter 10. Developing Struts applications . . . . . . . . . . . . . . . . . . . . . . . 293


What is Struts? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
MVC architectural pattern. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Controller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Dependencies between MVC layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
MVC framework with Struts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Application Developer support for Struts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Developing a Web application using Struts . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Creating a Struts Web project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Copying the facade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Importing RedBank Web content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Updating ApplicationResources.properties . . . . . . . . . . . . . . . . . . . . . . . . 306
Creating the Struts Web diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Implementing the Struts Web diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Developing the form beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310

viii WebSphere Studio Application Developer Version 5 Programming Guide


Developing the JSPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Developing the actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Using the Struts configuration file editor . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Testing the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344

Chapter 11. Developing XML applications . . . . . . . . . . . . . . . . . . . . . . . . 345


XML overview and technologies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
XML and XML processor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
DTD and XML schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Schema and style using XSLT and XSL . . . . . . . . . . . . . . . . . . . . . . . . . . 347
XML namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
XPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Application Developer XML tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Tools demonstrated in this chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Setting up your sample project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Creating a new XML file from scratch . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Creating an XML schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
XML generators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Generating a DTD from XSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Validate XML files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Generating an XML file from an XML schema . . . . . . . . . . . . . . . . . . . . . 359
Creating an XSL file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
Transforming XML files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Debugging XSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Generating JavaBeans from DTD or XSD . . . . . . . . . . . . . . . . . . . . . . . . 371
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
More information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372

Chapter 12. Developing EJB applications. . . . . . . . . . . . . . . . . . . . . . . . . 373


Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
EJB server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
EJB container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
EJB components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Sample Application: RedBank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Creating an EJB project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Data transfer objects and helper classes . . . . . . . . . . . . . . . . . . . . . . . . . 388
Implementing the model with entity beans . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Creating the entity beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Editing the entity beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
Creating entity relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Updating the TransRecord create method . . . . . . . . . . . . . . . . . . . . . . . . 404
Creating custom finders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406

Contents ix
Object-relational mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Implementing the session facade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Creating the session bean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
Creating an EJB reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
Editing the session bean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Generating the deployed code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
Completing the EJB deployment descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Changing the data source for EJB access . . . . . . . . . . . . . . . . . . . . . . . . 428
Testing the EJBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Universal test client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Adapting the Web applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
Web project dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
EJB references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
Testing the Web interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440

Chapter 13. Developing Web services. . . . . . . . . . . . . . . . . . . . . . . . . . . . 441


The concept of a service-oriented architecture (SOA) . . . . . . . . . . . . . . . . . . 442
Web services approach for an SOA architecture . . . . . . . . . . . . . . . . . . . . . . 443
Web services tools in Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . 445
Bottom-up development of a Web service . . . . . . . . . . . . . . . . . . . . . . . . 445
Top-down development of a Web service . . . . . . . . . . . . . . . . . . . . . . . . . 445
Client development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Preparation for samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Creating a Web service from a JavaBean . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Creating the Web service using the Web Service wizard . . . . . . . . . . . . . 447
Generated files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Testing the Web service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Using the sample test application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Using the universal test client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Creating a Web service client. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Run the Web Service Client wizard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Creating a Web service from a session bean. . . . . . . . . . . . . . . . . . . . . . . . . 464
Implementing a real client application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
More information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467

Chapter 14. Developing GUI applications . . . . . . . . . . . . . . . . . . . . . . . . . 469


Introduction to the Visual Editor for Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
Sample GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
Setting up your sample project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Launching the Visual Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
Create a visual class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473

x WebSphere Studio Application Developer Version 5 Programming Guide


Open an existing class with the Visual Editor . . . . . . . . . . . . . . . . . . . . . . 475
Visual Editor look and feel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Customizing the appearance of the Visual Editor . . . . . . . . . . . . . . . . . . . . . 478
Changing the default Java Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
Working with the Visual Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Resizing a JavaBean component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Code synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Add JavaBeans to a visual class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
Working with the Properties view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
Working with the Java Beans view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
Extending the sample GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492
Adding data to the JavaBean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
Adding additional methods to the sample GUI . . . . . . . . . . . . . . . . . . . . . . . . 500
Writing event handling code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502
Running and testing JavaBeans. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
Running the sample GUI as a JavaBean . . . . . . . . . . . . . . . . . . . . . . . . . 505
Running the sample GUI as a Java application . . . . . . . . . . . . . . . . . . . . 507
Testing the sample GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
Running the sample outside of Application Developer . . . . . . . . . . . . . . . . . . 508
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509

Part 3. Testing and debugging applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511

Chapter 15. Servers and server configurations . . . . . . . . . . . . . . . . . . . . 513


Server tools feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
Supported run-time environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
Creating server and server configuration automatically . . . . . . . . . . . . . . . . . 516
Creating server and server configuration manually . . . . . . . . . . . . . . . . . . . . 519
Creating a Server project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
Creating a remote server and file transfer mechanism . . . . . . . . . . . . . . . 520
Creating a server configuration manually . . . . . . . . . . . . . . . . . . . . . . . . . 527
Assigning a server configuration to a server . . . . . . . . . . . . . . . . . . . . . . . 530
Creating a server and server configuration together . . . . . . . . . . . . . . . . . . . 530
Assigning a project to a server configuration . . . . . . . . . . . . . . . . . . . . . . . . . 531
Configuring the data source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
Starting and stopping servers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
Changing the applications to run on a remote server. . . . . . . . . . . . . . . . . . . 538
Apache Tomcat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
TCP/IP Monitor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
Configuring the TCP/IP Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Using the TCP/IP Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
Customizing server configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544
Server page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544

Contents xi
Configuration page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
Applications page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
Administrative console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
Applying Fix Packs to the WebSphere test environment . . . . . . . . . . . . . . . . 549
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551

Chapter 16. Testing and debugging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553


Debugging a Web application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
Setting breakpoints in a servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
Setting breakpoints in a JSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556
Testing the application with breakpoints enabled. . . . . . . . . . . . . . . . . . . . . . 557
Debug view with stack frames. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560
Debug functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560
Breakpoints view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Watching variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Inspecting variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
Evaluating an expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
Debugging a JSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
Debugging on a remote WebSphere Application Server . . . . . . . . . . . . . . . . 566
Configuring the remote server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
Attaching to remote server in Application Developer . . . . . . . . . . . . . . . . 567
Connecting to the remote server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
Debugging on the remote server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
Disconnecting from the remote server . . . . . . . . . . . . . . . . . . . . . . . . . . . 572
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572

Chapter 17. JUnit and component testing . . . . . . . . . . . . . . . . . . . . . . . . 573


What is JUnit? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Unit testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Why unit testing?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Benefits of a unit testing framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
Testing with JUnit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576
TestCase class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
TestSuite class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
Creating the test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
Importing the model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
Preparing for JUnit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
Creating a test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
The setUp and tearDown methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582
Test methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582
Creating a TestSuite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584
Running the test case. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586
Testing the Web applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588

xii WebSphere Studio Application Developer Version 5 Programming Guide


Component testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
Creating a Java test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
Preparing a Java test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
Updating code of Java test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
Running a Java test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594
Report test case results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
Creating an HTTP test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603

Part 4. Deploying and profiling applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605

Chapter 18. Deploying enterprise applications . . . . . . . . . . . . . . . . . . . . 607


Enterprise application deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
Importing the enterprise application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
Working with deployment descriptors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
EJB deployment descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609
Web deployment descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
Application client module deployment descriptor . . . . . . . . . . . . . . . . . . . 613
Building an application client module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
Exporting an enterprise application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616
Configuring WebSphere Application Server . . . . . . . . . . . . . . . . . . . . . . . . . . 617
Start the server and the administrative console . . . . . . . . . . . . . . . . . . . . 617
Configuring a server (optional) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618
Configuring a JDBC driver and data source . . . . . . . . . . . . . . . . . . . . . . . 618
Save the configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
Installing an enterprise application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
Regenerating HTTP Server plug-in configuration . . . . . . . . . . . . . . . . . . . 627
Starting the enterprise application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627
Testing the applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
Remote debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
Command line tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
Batch commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
Scripting tool: wsadmin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630
Classpath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632

Chapter 19. Building applications with Ant . . . . . . . . . . . . . . . . . . . . . . . 633


What is Ant? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634
Sample demo project and application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
Ant build files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
Ant tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
Creating a simple build file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
Project definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
Global properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639

Contents xiii
Build targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
Running Ant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
Where is the output? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643
Rerunning Ant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643
Forced build . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
Classpath problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
Building J2EE applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
Using or importing a J2EE project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
Ant J2EE build script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
Running Ant for J2EE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650
Building Javadoc with Ant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651
Running Ant outside of Application Developer . . . . . . . . . . . . . . . . . . . . . . . . 652
Preparation of the command file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652
Running the command file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654

Chapter 20. Profiling applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655


Profiling architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656
Profiling Java processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657
Agent Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657
Profiling an application in the WebSphere Test Environment . . . . . . . . . . 658
Attaching to a Java process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658
Start monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662
Performance analysis views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663
Launch Java process for profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663
Profiling remote processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
Performance analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666
Package statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667
Class method statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668
Method statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670
Method invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674
Method execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
Execution flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679
Sequence diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
Instance statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682
Object references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684
Some things to be aware of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685

Part 5. Team programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687

Chapter 21. Version control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689


Local history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690

xiv WebSphere Studio Application Developer Version 5 Programming Guide


Comparing files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
Replacing files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
Restoring deleted files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692
Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692
Team development. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693
Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694
Application Developer team support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698
Terminology comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700

Chapter 22. Using Concurrent Versions System . . . . . . . . . . . . . . . . . . . 701


Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702
Installing CVS on the Windows platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703
Creating a CVS repository on CVSNT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703
Configuring CVS in Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . 706
What is new in Application Developer Version 5?. . . . . . . . . . . . . . . . . . . 706
CVS preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
What changes could impact your work? . . . . . . . . . . . . . . . . . . . . . . . . . . 710
Ignoring resources from version control . . . . . . . . . . . . . . . . . . . . . . . . . . 711
Label decorations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712
CVS console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712
Development scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713
Creating and sharing the project (step 1 - stade1) . . . . . . . . . . . . . . . . . . 714
Adding a shared project to the workspace (step 2 - stade2) . . . . . . . . . . . 719
Synchronizing with repository (step 3 - stade1) . . . . . . . . . . . . . . . . . . . . 722
Parallel development (step 4 - stade1 and stade2). . . . . . . . . . . . . . . . . . 723
Resolving conflicts (step 5 - stade1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724
Versioning (step 6 - stade1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730
CVS resource history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731
Branches in CVS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733
Branching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734
Merging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736
Defining branch tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739
Working with patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740
Creating a patch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740
Applying a patch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742
Disconnecting a project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746

Chapter 23. Using ClearCase . . . . . . . . . . . . . . . . . . . . . ....... ...... . 747


What is Rational ClearCase? . . . . . . . . . . . . . . . . . . . . . . . ....... ...... . 748
Basic ClearCase terminology . . . . . . . . . . . . . . . . . . . . . . . ....... ...... . 749
Installing ClearCase LT . . . . . . . . . . . . . . . . . . . . . . . . . . . ....... ...... . 749

Contents xv
Installing ClearCase LT Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750
Installing the ClearCase LT client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752
ClearCase integration with Application Developer . . . . . . . . . . . . . . . . . . . . . 752
ClearCase help in Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . 753
ClearCase preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753
Using ClearCase with Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . 754
Setting up ClearCase for a new project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756
Creating a new VOB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756
Creating new ClearCase project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
Joining a ClearCase project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759
Creating a Web project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 762
Adding a project to ClearCase source control. . . . . . . . . . . . . . . . . . . . . . 762
Development scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765
Developer 1 adds a servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765
Developer 1 delivers work to the integration stream . . . . . . . . . . . . . . . . . 768
Developer 1 makes a baseline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 770
Developer 2 joins the project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 772
Developer 2 imports projects into Application Developer . . . . . . . . . . . . . 774
Developer 2 adds a new servlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 776
Developer 2 delivers work to the integration stream . . . . . . . . . . . . . . . . . 778
Developer 2 makes a new baseline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779
Developers synchronize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782

Part 6. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783

Appendix A. Product installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785


Installing DB2 UDB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786
Installing WebSphere Application Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786
Hardware prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786
Software prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786
Installation Application Server 5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787
Verifying the installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789
Installing Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
Hardware prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
Software prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
Installing Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
Installing the Agent Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792
Update Application Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793
Using the Update Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793
Manual update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798

Appendix B. Keyboard shortcuts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801


Workbench shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802

xvi WebSphere Studio Application Developer Version 5 Programming Guide


Editing shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
Java editor shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803
Java development tools shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804
Debug perspective shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805
Page and CSS Designer shortcuts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805
Page Designer source page shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807

Appendix C. Additional material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809


Locating the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809
Using the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810
System requirements for downloading the Web material . . . . . . . . . . . . . 810
How to use the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810
Installing the EJBBANK database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811
Installing the ItsoProGuide.ear file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 812
Installing the server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 814
Installing other projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 814
DB2 user ID and password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 814

Abbreviations and acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815

Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817


IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817
Other publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818
Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818
How to get IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821

Contents xvii
xviii WebSphere Studio Application Developer Version 5 Programming Guide
Notices

This information was developed for products and services offered in the U.S.A.

IBM may not offer the products, services, or features discussed in this document in other countries. Consult
your local IBM representative for information on the products and services currently available in your area.
Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM
product, program, or service may be used. Any functionally equivalent product, program, or service that
does not infringe any IBM intellectual property right may be used instead. However, it is the user's
responsibility to evaluate and verify the operation of any non-IBM product, program, or service.

IBM may have patents or pending patent applications covering subject matter described in this document.
The furnishing of this document does not give you any license to these patents. You can send license
inquiries, in writing, to:
IBM Director of Licensing, IBM Corporation, North Castle Drive Armonk, NY 10504-1785 U.S.A.
The following paragraph does not apply to the United Kingdom or any other country where such provisions
are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES
THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer
of express or implied warranties in certain transactions, therefore, this statement may not apply to you.

This information could include technical inaccuracies or typographical errors. Changes are periodically made
to the information herein; these changes will be incorporated in new editions of the publication. IBM may
make improvements and/or changes in the product(s) and/or the program(s) described in this publication at
any time without notice.

Any references in this information to non-IBM Web sites are provided for convenience only and do not in any
manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the
materials for this IBM product and use of those Web sites is at your own risk.

IBM may use or distribute any of the information you supply in any way it believes appropriate without
incurring any obligation to you.

Information concerning non-IBM products was obtained from the suppliers of those products, their published
announcements or other publicly available sources. IBM has not tested those products and cannot confirm
the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on
the capabilities of non-IBM products should be addressed to the suppliers of those products.

This information contains examples of data and reports used in daily business operations. To illustrate them
as completely as possible, the examples include the names of individuals, companies, brands, and products.
All of these names are fictitious and any similarity to the names and addresses used by an actual business
enterprise is entirely coincidental.

COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrates programming
techniques on various operating platforms. You may copy, modify, and distribute these sample programs in
any form without payment to IBM, for the purposes of developing, using, marketing or distributing application
programs conforming to the application programming interface for the operating platform for which the
sample programs are written. These examples have not been thoroughly tested under all conditions. IBM,
therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. You may copy,
modify, and distribute these sample programs in any form without payment to IBM for the purposes of
developing, using, marketing, or distributing application programs conforming to IBM's application
programming interfaces.

© Copyright IBM Corp. 2003. All rights reserved. xix


Trademarks
The following terms are trademarks of the International Business Machines Corporation in the United States,
other countries, or both:

AIX® ^™ Redbooks™
BookMaster® Informix® Redbooks (logo) ™
Cloudscape™ IBM® SAA®
CICS® ibm.com® VisualAge®
Domino™ IMS™ WebSphere®
DB2® Lotus® z/OS®
™ Notes®

The following terms are trademarks of International Business Machines Corporation and Rational Software
Corporation, in the United States, other countries or both.

ClearCase® Rational®

The following terms are trademarks of other companies:

Intel, Intel Inside (logos), MMX, and Pentium are trademarks of Intel Corporation in the United States, other
countries, or both.

Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the
United States, other countries, or both.

Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun
Microsystems, Inc. in the United States, other countries, or both.

UNIX is a registered trademark of The Open Group in the United States and other countries.

SET, SET Secure Electronic Transaction, and the SET Logo are trademarks owned by SET Secure
Electronic Transaction LLC.

Other company, product, and service names may be trademarks or service marks of others.

xx WebSphere Studio Application Developer Version 5 Programming Guide


Preface

This IBM® Redbook is a programming guide for the application development


tool, WebSphere® Studio Application Developer V5. This tool is not only
intended for the Java™ developer, but also for the Web designer who creates
Web pages. The WebSphere Studio Application Developer basic tooling and
team environment is presented along with the development and deployment of
Web applications.

WebSphere Studio Application Developer provides integrated development tools


for all e-business development roles, including Web developers, Java
developers, business analysts, architects, and enterprise programmers. The
customizable, targeted, role-based approach of WebSphere Studio Application
Developer will be characteristic of all new products built on the WebSphere
Studio Workbench. It is well integrated with WebSphere Application Server and
provides built-in server test environments that can be used for testing and
profiling Web applications.

This redbook consists of six parts:


򐂰 Introducing WebSphere Studio Application Developer
򐂰 Developing applications
򐂰 Testing and debugging applications
򐂰 Deploying and profiling applications
򐂰 Team programming
򐂰 Appendixes and additional material

© Copyright IBM Corp. 2003. All rights reserved. xxi


The team that wrote this redbook
This redbook was produced by a team of specialists from around the world
working at the International Technical Support Organization, Raleigh Center.

Ian Maik Ueli Fabio Henrik

Ueli Wahli is a Consultant IT Specialist at the IBM International Technical


Support Organization in San Jose, California. Before joining the ITSO 19 years
ago, Ueli worked in technical support at IBM Switzerland. He writes extensively
and teaches IBM classes worldwide on application development, object
technology, VisualAge® for Java, WebSphere Application Server, and lately
WebSphere Studio products. In his ITSO career Ueli has produced over 25 IBM
Redbooks™. Ueli holds a degree in Mathematics from the Swiss Federal
Institute of Technology.

Ian Brown is a Consultant for ASTECH Solutions Inc. in Aurora, Ontario,


Canada. He has 5 years of experience in the field of information technology, and
2 years of experience in analysis, design and development of Web and J2EE
applications. He holds a degree in Computer Science from the University of
Waterloo. His areas of expertise include application development using the
Eclipse platform, Java, and WebSphere Application Server administration.

Fabio Ferraz is the Chief Consultant for e-Voilà Enabling in Rio de Janeiro,
Brazil. He has years 11 years of experience in the IT field, and 8 of those
dedicated to e-business.

xxii WebSphere Studio Application Developer Version 5 Programming Guide


Maik Schumacher is an IT Specialist at IBM Software Services for Lotus® in
Cologne, Germany. He has 9 years of experience in the field of information
technology and he has been with IBM for two years, mainly working on an
architecture of e-business solutions. Maik is a Principal Certified Lotus
Professional and holds a degree in Computer Science with Business from the
University of Applied Sciences in Dortmund, Germany. His areas of expertise are
in software development, e-business, and Internet design.

Henrik Sjostrand is an Advisory IT Specialist working for IBM Sweden since 8


years. He has 12 years of experience in the field of information technology.
During his time with IBM he has had a number of different positions from
consulting and education to pre-sales activities. The last 3 years he has focused
on e-business application development, and WebSphere Application Server
architecture and deployment. Henrik is certified in WebSphere Application
Server 4.0 and holds a Master of Science in Electrical Engineering from
Chalmers University of Technology in Gothenburg, Sweden, where he lives.

Thanks to the following people for their contributions to this project:

Osamu Takagiwa, Joseph Korchmar, Arne Lindquist, and Martin Vojtko, who
wrote the original redbook, WebSphere Studio Application Developer
Programming Guide, SG24-6585.

Yvonne Lyon, for technical editing


International Technical Support Organization, San Jose Center

Become a published author


Join us for a two- to six-week residency program! Help write an IBM Redbook
dealing with specific products or solutions, while getting hands-on experience
with leading-edge technologies. You'll team with IBM technical professionals,
Business Partners and/or customers.

Your efforts will help increase product acceptance and customer satisfaction. As
a bonus, you'll develop a network of contacts in IBM development labs, and
increase your productivity and marketability.

Find out more about the residency program, browse the residency index, and
apply online at:
ibm.com/redbooks/residencies.html

Preface xxiii
Comments welcome
Your comments are important to us!

We want our Redbooks to be as helpful as possible. Send us your comments


about this or other Redbooks in one of the following ways:
򐂰 Use the online Contact us review redbook form found at:
ibm.com/redbooks
򐂰 Send your comments in an Internet note to:
[email protected]
򐂰 Mail your comments to:
IBM Corporation, International Technical Support Organization
Dept. HZ8 Building 662
P.O. Box 12195
Research Triangle Park, NC 27709-2195

xxiv WebSphere Studio Application Developer Version 5 Programming Guide


Summary of changes from SG24-6585
This section describes the technical changes made in this edition of the book and
in previous editions. This edition may also include minor corrections and editorial
changes that are not identified.

Summary of Changes
for SG24-6957-00
for WebSphere Studio Application Developer Version 5 Programming Guide
as created or updated on July 16, 2003.

July 2003, First Edition


This book is a major rewrite of WebSphere Studio Application Developer
Programming Guide, SG24-6585. The previous book was based on Application
Developer Version 4, this book is based on Version 5.

This revision reflects the addition, deletion, or modification of new and changed
information described below.

New information
򐂰 Support for J2EE 1.3, including EJB 2.0, Servlet 2.3, and JSP 1.2 levels
򐂰 New chapters on XML development, EJB development, Web services
development, Struts development, GUI application development
򐂰 Filters and listeners in Web development
򐂰 Support for DB2® stored procedures
򐂰 Component testing in the JUnit chapter
򐂰 Usability enhancements for Common Versions System

Changed information
򐂰 General update of existing information to Version 5

Deleted information
򐂰 Migration—covered very well in the migration guide that is shipped with the
product
򐂰 Plugin development—Very good information in a new book: The Java
Developer’s Guide to Eclipse (see “Other publications” on page 818)

Preface xxv
xxvi WebSphere Studio Application Developer Version 5 Programming Guide
Part 1

Part 1 Introducing
WebSphere Studio
Part 1 introduces WebSphere Studio Application Developer with concepts about
the Workbench, tools, workspace, perspectives, and projects.

© Copyright IBM Corp. 2003. All rights reserved. 1


2 WebSphere Studio Application Developer Version 5 Programming Guide
1

Chapter 1. Introduction and concepts


This chapter contains an introduction to the concepts behind Application
Developer. An overview of the features and the WebSphere Studio family is
provided as well. The following topics are discussed:
򐂰 Eclipse
򐂰 Platform architecture
򐂰 Workbench features
򐂰 WebSphere Studio products
򐂰 What is new in Application Developer Version 5
򐂰 Tools
򐂰 Sample code in this book

© Copyright IBM Corp. 2003. All rights reserved. 3


Introduction
WebSphere Studio Application Developer (hereafter called Application
Developer) is one of the WebSphere Studio family of products that has been
developed based on the Eclipse Workbench.

The Eclipse Workbench platform was designed by IBM and released to the open
source community. It is an open, portable, universal tooling platform that provides
frameworks, services, and tools for building tools.

In essence, the Workbench provides the tool infrastructure. With this


infrastructure in place, the tool builders are able to focus on the actual building of
their tools. The Workbench has been designed for maximum flexibility to support
the development of tools for new technologies that may emerge in the future.

Development environments written for the Workbench should support a


role-based development model, in which the outcomes of the developers’ work
will be consistent. The developers should not have to be concerned with how
different individual tools may be treating their files.

The WebSphere Studio product family is based on an integrated development


environment (IDE) for developing, testing, debugging, and deploying
applications. It provides support for each phase of the application development
life cycle.

Eclipse
Eclipse is an open platform for tool integration built by an open community of tool
providers. With a common public license that provides royalty free source code
and world wide redistribution rights, the Eclipse platform provides tool developers
with ultimate flexibility and control over their software technology.

Industry leaders like IBM, Borland, Merant, QNX Software Systems, Rational®
Software, RedHat, SuSE, TogetherSoft, and WebGain formed the initial
eclipse.org board of directors of the Eclipse open source project. Visit the
Eclipse Web Site for more information about the project:
http://www.eclipse.org

Platform architecture
Figure 1-1 shows an overview of the Eclipse platform.

4 WebSphere Studio Application Developer Version 5 Programming Guide


Figure 1-1 Eclipse platform

Eclipse is a platform that has been designed from the ground up for building
integrated regardless of presentation technology and application development
tooling. By design, the platform itself does not provide a great deal of end user
functionality. The value of the platform is what it encourages: rapid development
of integrated features based on a plug-in model.

Eclipse provides a common user interface (UI) model for working with tools. It is
designed to run on multiple operating systems while providing robust integration
with each underlying OS. Plug-ins can be programmed to the Eclipse portable
APIs and run unchanged on any of the supported operating systems.

The Eclipse platform uses the model of a common Workbench to integrate the
tools from the end user's point of view. Tools that you develop can be plugged
into the Workbench using well defined hooks called extension points.

The underlying platform runtime uses the same extension model to allow plug-in
developers to add support for additional file types and customized installations,
such as Web servers, workgroup servers, and repositories. The artifacts for each
tool, such as files and other data, are coordinated by a common platform
resource model.

The platform gives the users a common way to work with the tools, and provides
integrated management of the resources they create with plug-ins.

Chapter 1. Introduction and concepts 5


Workbench features
The Eclipse Workbench provides a set of APIs, models, and frameworks for
developing source editors and other user interfaces, as well as access to
common services for resource management, debugging, and team
programming.

The main features of the Eclipse Workbench are:


򐂰 Plug-in based tooling
򐂰 Role-oriented development tools
򐂰 Vertical and horizontal integration
򐂰 Open standards
򐂰 Open team environment
򐂰 File based IDE

Plug-in based tooling


The Workbench provides a flexible plug-in platform. Different tools can plug in to
the Workbench, with each tool providing new functionality to be added to the
Workbench or to already existing plug-ins. Each plug-in integrates with the
Workbench and with the other tools. Ideally the end-user should not notice any
difference when moving from one tool to another.

By programming to the portable Eclipse APIs, plug-ins can run unchanged on


any of the supported operating systems using a common user interface model.
The Workbench is designed to run on multiple operating systems while providing
robust integration with each one.

At the core of Eclipse is an architecture for dynamic discovery of plug-ins. The


platform handles the logistics of the base environment and provides a standard
user navigation model. Each plug-in can focus on performing a small number of
tasks well, without having to provide the supporting infrastructure. Some
examples of such tasks are defining, testing, animating, publishing, compiling,
debugging, and diagramming.

Because the Workbench is based on an open architecture, each plug-in


development team can focus on their area of expertise. This enables the team
management experts to build the back-end interfaces and the usability experts to
build the end user tools. If these are well designed, and use the standard APIs,
significant new features and levels of integration can be added to the Workbench
and Workbench based products without impacting other tools.

6 WebSphere Studio Application Developer Version 5 Programming Guide


Role-oriented development with consistent look and feel
The Workbench is designed to provide special support for a particular e-business
development role, or for a set of roles.

Within the Workbench based products, task-oriented perspectives filter out much
of the overall complexity, and present the developer only with those functions that
are relevant to the task at hand.

Users can switch perspectives depending on what they are working on at any
given moment, or depending on their current role in the project.

Because different developers are accustomed to working in different ways, any


perspective can be further customized. And because all tools and perspectives
are built using the Eclipse Workbench technology, they share a common look and
feel, which reduces learning curves and help maximize developer productivity.

All development resources for all projects are stored in a single repository,
therefore developers have consistent team support for their projects, and are
able to easily share their work products.

Vertical and horizontal integration


Traditionally software vendors have provided vertical tools, forcing customers to
do their own integration. The purpose of the Eclipse Workbench is to provide a
platform that software vendors can easily extend. ISVs have already embraced
this technology and are actively building tools on this base.

As an example, every WebSphere Studio family of products that is built on the


Workbench offers a set of already integrated tools, freeing you to focus on
building applications rather than on integrating tools. Furthermore, you can easily
integrate other tools (from other vendors or locally developed), as long as they
conform to the Workbench standard plug-in protocol.

Open standards
The whole Eclipse Workbench, as well as all products of the WebSphere Studio
family of products, are built on open standards and the code that they generate
also complies with open standards.

This allows you to build and deploy state-of-the-art, server-side applications that
conform to the Servlet 2.2, JavaServer Pages 1.1, and EJB 1.1 specifications.

Chapter 1. Introduction and concepts 7


Open team development
Application development teams are becoming more distributed, more diverse,
and are under increasing pressure to deliver solutions quickly. In such an
environment it is critical to have development tools that can support these needs,
while at the same time addressing personalized requirements. The team
development environment for all products based on the Eclipse Workbench
supports pluggable repositories rather than mandating any proprietary
repository, and support an optimistic concurrency model.

File-based IDE
The Eclipse Workbench is a platform for building file-based IDEs. All content is
saved as files. Workbench resources, such as Java classes and HTML files, are
stored in the file system, making them easy to access.

WebSphere Studio products


The WebSphere Studio product family is built on top of the Eclipse Workbench as
a set of plug-ins conforming to the Workbench’s open standard APIs.

The WebSphere Studio family of products currently has the following members
(Figure 1-2):
򐂰 WebSphere Studio Site Developer Advanced
򐂰 WebSphere Studio Application Developer
򐂰 WebSphere Studio Application Developer Integration Edition
򐂰 WebSphere Studio Enterprise Developer

These products provide support for end-to-end development, testing, and


deployment of Web and J2EE applications.

The WebSphere Studio product family provide integrated development tools for
most e-business development roles including Web developers, Java developers,
business analysts, architects, and enterprise programmers. The customizable,
targeted and role-oriented approach of the Workbench will be a common
characteristic of future products in the WebSphere Studio family.

8 WebSphere Studio Application Developer Version 5 Programming Guide


Enterprise Developer
User: Enterprise
Application Developer Integration Edition Developer
Function:
Application Developer Create new EIS
applications as part
Site Developer User: Advanced J2EE of a J2EE app
Developer EGL Tools
User: Web Developer User: J2EE Developer
Function: Develop/Maintain
Function: Function:
Access existing EIS z/OS Apps
HTML/JSP/Servlet EJB Tools applications using COBOL
Struts Tools
Web Services Tools
+ Performance and
Trace tools
Component Test tools
+ JCA
Visual Service Flow + PL/I
ASM
XML Tools Choreography COBOL XML
Java Visual Editor ClearCase LT OEM Target Runtime: Enablement
Target Runtime: Target Runtime: WAS AE, ND, WAS E Target Runtime: WAS
WAS AE, WAS ND WAS AE, WAS ND AE, ND, WAS E, z/OS

WebSphere Studio Workbench


IBM's commerically supported version of Eclipse Basis for IBM Tooling

Eclipse Workbench
Provides frameworks for tool builders
to focus on tool building

Figure 1-2 WebSphere Studio family

WebSphere Studio Site Developer


Site Developer is an IDE intended for Web developers who develop and manage
complex Web sites. It is an easy-to-use environment that minimizes the time and
effort required to create, manage, and debug multi-platform Web sites. It is
designed according to the J2SE and J2EE specifications and supports JSPs,
servlets, HTML, JavaScript, and DHTML. It further includes tools for developing
images and animated GIFs.

Site Developer enables Web developers to use their favorite content creation
tools in conjunction with the built-in local and remote publishing capabilities.

Using Site Developer, you can develop Web applications that use the following
technologies.
򐂰 JSPs—A simple, fast, and consistent way to extend Web server functionality
and create dynamic Web content. JSPs enable rapid development of Web
applications that are server and platform-independent.
򐂰 Servlets—Server code that executes within a Web Application Server.
򐂰 Web services—Self-contained, modular applications that can be described,
published, located, and invoked over the Internet or within intranets.

Chapter 1. Introduction and concepts 9


WebSphere Studio Application Developer
Application Developer is designed for professional developers of Java and J2EE
applications, who require integrated Java, Web, XML, and Web services support.

It includes all of the features of Site Developer, and adds tools for developing EJB
applications, as well as performance profiling and logging tools for both local and
remote execution.

Developers can quickly build and test business logic and enhance the
presentation artifacts with built-in Web creation tools inside the Application
Developer IDE before deploying to a production server.

Using the performance profiling and tracing tools, it is possible to detect


application performance bottlenecks early in the development cycle.
Furthermore, the built-in test environment for WebSphere Application Server and
advanced tools for code generation help shorten the test cycle.

WebSphere Studio Application Developer Integration Edition


Integration Edition includes all of the functionality in Application Developer, plus:
򐂰 Powerful graphical tools to help you quickly and easily build custom
application adapters to integrate your J2EE application with your back-end
systems, helping you save time and money by reusing existing resources.
򐂰 Visual flow-based tools that increase developers productivity by allowing them
to visually define the sequence and flow of information between application
artifacts such as adapters, Enterprise JavaBeans components and Web
services.
򐂰 Wizards that help in building and deploying complex Web services out of
adapters, EJB components, flows, and other Web services.
򐂰 Support for the full set of Enterprise services provided by WebSphere
Application Server Enterprise Edition such as business rule beans,
internationalization, and work areas that deliver additional integration
capabilities, developer productivity, and business agility.

WebSphere Enterprise Developer


Enterprise Developer includes all of the functionality in WebSphere Studio
Application Developer Integration Edition, plus among others:
򐂰 Integrating transactional environments such as CICS® and IMS™
򐂰 Creating new EIS applications as part of a J2EE application
򐂰 Developing and maintaining z/OS® applications
򐂰 Supporting Java, COBOL, PL/I, and EGL (enterprise generation language)
development

10 WebSphere Studio Application Developer Version 5 Programming Guide


򐂰 Implementing Struts-based MVC applications using connectors and EGL.

Here is another core technology that is integrated within Enterprise Developer:


򐂰 WebSphere Studio Asset Analyzer (WSAA)—Identifies application processes
and connecting points, and provides the ability to generate components from
existing code.

Enterprise Developer provides a visual construction and assembly based


environment supporting the implementation of enterprise level applications,
including support for the multiple developer roles and technologies required by
those applications. Some examples of technologies supported are HTML, JSPs,
servlets, EJBs, COBOL, EGL, PL/I, and connectors.

What is new in Application Developer Version 5


Application Developer Version 5 contains many new and improved features. For
details about changes to specific product features, refer to the readme file located
in the readme subdirectory of both the installation CD and the WebSphere Studio
installation directory (Windows® users can also access the readme file directly
from the Start menu, after installing WebSphere Studio).

Here are some highlights of the new features:


򐂰 Support for J2EE 1.3, including EJB 2.0, Servlet 2.3, and JSP 1.2 levels
򐂰 Concurrent support for WebSphere Application Server V4 (J2EE 1.2) and
WebSphere Application Server V5 (J2EE 1.3)
򐂰 Enables WebSphere Application Server Version 4 users to adopt the latest
innovations from Eclipse Version 2, and enhancements from Application
Developer Version 5 without server upgrade
򐂰 Numerous updates and new functions for Java, Web services, XML,
Database, Test and Analysis, and Web components
򐂰 Specialized support for Struts, which is a set of Java classes and JSP tag
libraries that provide a conceptual framework for developing Web applications
򐂰 New Visual Editor for Java (Java-based client for building GUI components
with Swing or AWT)
򐂰 XSL source editor; new wizards to help you create your XSL files

Chapter 1. Introduction and concepts 11


Migration from previous versions
The root directory of Application Developer’s installation CD contains a migration
guide that is provided in the migrate.pdf and the migrate.html files.

This migration guide discusses how you can:


򐂰 Target WebSphere Application Server Version 4.0.x versus Version 5
򐂰 Migrate from WebSphere Studio Application Developer Version 4.0.x
򐂰 Migrate from WebSphere Studio Application Developer Version 5 Beta
򐂰 Migrate from WebSphere Studio Classic to WebSphere Studio Application
Developer
򐂰 Migrate from VisualAge for Java to WebSphere Studio Application Developer
򐂰 Migrate from WebSphere Studio Application Developer for Linux
򐂰 Migrate enterprise beans from VisualAge for Java to WebSphere Studio
Application Developer
򐂰 Migrate from EJB 1.0 to EJB 1.1 or to EJB 2.0
򐂰 Migrate from VisualAge for Java Visual Composition Editor to Visual Editor for
Java
򐂰 Convert from VisualAge for Java Persistence Builder to EJB 2.0
򐂰 Build setup (library JARs, dependant project JARs, Ant builds)

The migration guide also provides some migration examples that show you, step
by step, how to migrate to Version 5 from previous versions.

Tools
The WebSphere Studio product family include the following basic tools:
򐂰 Web development
򐂰 Relational database
򐂰 XML
򐂰 Java development
򐂰 Web services development
򐂰 Team collaboration
򐂰 Integrated debugger
򐂰 Server tools for testing and deployment
򐂰 Enterprise JavaBean development tools (not in Site Developer Advanced)
򐂰 Performance profiling (not in Site Developer Advanced)
򐂰 Plug-in development

12 WebSphere Studio Application Developer Version 5 Programming Guide


Web development tools
The professional Web development environment provides the necessary tools to
develop sophisticated Web applications consisting of static HTML pages, JSPs,
servlets, XML deployment descriptors, and other resources.

Wizards are available to generate ready to run Web applications based on SQL
queries and JavaBeans. Links between Web pages can be automatically
updated when content is moved or renamed.

The Web development environment brings all aspects of Web application


development into one common interface. Everyone on your Web development
team, including content authors, graphic artists, programmers, and Web
masters, can work on the same projects and access the files they need.

Such an integrated Web development environment makes it easy to


collaboratively create, assemble, publish, deploy, and maintain dynamic,
interactive Web applications.

The Web development tools provide the following features:


򐂰 Support for latest Web technology with an intuitive user interface
򐂰 Advanced scripting support to create client-side dynamic applications with
VBScript or JavaScript
򐂰 Web Art Designer to create graphic titles, logos, buttons, and photo frames
with professional-looking touches
򐂰 Animated GIF Designer to create life-like animation from still pictures,
graphics, and animated banners
򐂰 Over 2,000 images and sounds in the built-in library
򐂰 Integrated, easy-to-use visual layout tool for JSP and HTML file creation and
editing
򐂰 Web project creation, using the J2EE-defined hierarchy
򐂰 Creation and visual editing of the Web application deployment descriptor
(web.xml) file
򐂰 Automatic update of links as resources are moved or renamed
򐂰 A wizard for creating servlets
򐂰 Generation of Web applications from database queries and JavaBeans
򐂰 J2EE WAR/EAR deployment support (not in Site Developer)
򐂰 Integration with the WebSphere unit test environment

Chapter 1. Introduction and concepts 13


Exploring the Variety of Random
Documents with Different Content
With considerable stateliness the woman sank on to a chair of purple
velvet.
The bald-headed man re-seated himself at the table and opened the
book. He turned to the boy with an almost ferocious sternness, which
made him shudder in spite of his bewilderment.
“Now then, my lad,” he said, “what’s your name?”
“I—I—I d-don’t think I know, sir,” stammered the boy, after this
question had been repeated twice.
“Oh, don’t you?” said the bald-headed man, his ferocity yielding to a
sudden pleasantness that seemed even more remarkable. “You
don’t think you knows? Bring the register, Harby. He don’t think he
knows!”
The boy’s confession of ignorance had conferred upon the bald-
headed man a sweetness of manner of which few would have
suspected him to be capable.
“Look up ‘C,’ Harby, vollum six,” said the bald-headed man, rubbing
his hands with much satisfaction, and then adjusting a pair of pince-
nez which hung by a gold cord from his neck. “Open wound on the
face.”
The woman turned sharply to the little girl.
“Come here, child,” she said. “Have I not told you to keep away from
that horrid boy?”
Without paying the least attention to the woman, the little girl touched
the hand of the boy with a kind of odd confidentialness.
“I yike oo velly much,” she said.
“We shall not detain you, my lady,” said the bald-headed man,
bestowing a studious attention upon his diction. “But I’m afraid we
must trouble you to come to see the magistrate to-morrow morning
at eleven. The accused will be detained in custody. He has all the
appearance of being an old hand. By to-morrow we shall hope to
have found out a bit more about him.”
“Why don’t you give me my purse?” said the woman. “I can’t live
without it.”
“Was a purse found on the accused, Moxon?” said the bald-headed
man to the stouter of the two original constables.
“No, sir,” said Moxon, “on’y fourpence in copper and a foreign book.”
“Hand them to me,” said the bald-headed man peremptorily, “and go
over him properly.”
The boy was taken by two policemen into a room close by.
Immediately they began to pull off his clothes. To his extreme horror,
bewilderment and shame they stripped him stark naked. They lifted
up his heels and passed their fingers between his toes; they held up
his arms and pressed their hands into his armpits; they ran their
fingers through his hair, and placed them in his mouth.
“No purse,” they said.
They left the boy naked, with all his clothes on the floor. As the door
closed behind them he fell senseless on the cold stone. A long and
vague period followed, which was veiled from his consciousness by
a kind of semi-darkness. During that period he seemed to find
himself again in the presence of the bald-headed man, who still sat
at his desk and glared at him over the rims of his gold eye-glasses.
The boy had only the haziest knowledge of that which took place;
and subsequently was never able to satisfy himself as to whether or
not he was again wearing clothes at this interview. At least he had no
recollection of having put them on again or of any one else having
done so.
The beautiful woman street-person in the gay clothes, and the little
girl with golden curls, had gone away. The large and gloomy room
smelt very oppressive, and seemed full of police constables.
“Have you a father?” said the bald-headed man. Although all was
darkness and confusion about the boy the harsh voice seemed to
cause his heart to stop beating.
The boy made some inaudible reply, which finally was taken for an
answer in the affirmative.
“A mother?”
A further inaudible reply was taken to be a negative.
“What is the name of your father?”
“I—I—I d-don’t think I know, sir,” stammered the boy.
“Now then, none o’ that, or it will be ’otted up for you.”
The voice of the bald-headed man caused the boy’s teeth to chatter.
“What is your father?”
The boy lifted up his strange eyes in dumb bewilderment.
“I think he’s a little bit touched, sir,” said a very melancholy-looking
police constable, tapping his head with his forefinger.
“You think nothing, Gravener,” said the bald-headed man sternly.
“What right have you to think? You’ve been in the Force long enough
to know that. What does your father do?” he said to the boy.
After a moment a flash of intelligence seemed to fuse the deadly
pallor of the boy’s face.
“H-he keeps a lot of books,” he said, “a lot of books written by the
ancient authors.”
“Vendor of old books, eh? Where does he live?”
For a moment the dark curtain of incomprehension again descended
upon the boy; but quite suddenly it lifted and his mind was illumined
with a ray of meaning.
“My father lives in the street of the second among the English
authors,” he said.
“Now then, now then,” said the bald-headed man. “If you talk in that
way I’ll promise you it will be ’otted up for you.”
“I—I know the author’s name quite well,” said the boy, disregarding
this reproof, for his mind was reverting now to the little room, which
already he seemed to have left an epoch ago. “The name begins
with the letter M. M—Mi—Mil—it is the street of Milton!”
“Milton Street—vendor of old books in Milton Street. What number?”
“N-number!” muttered the boy blankly. “N-number. Oh yes! The
number of the shop of my father is the number of the year in which
Ovid was born.”
“Hovvid!” said the bald-headed man impatiently. “Who the ’ell’s
Hovvid? Do you know, Harby, who Hovvid is?”
“Not I!” said a solemn, grey-headed police constable. “Do you know,
Pearson?”
“Hovvid!” said a police constable with mutton-chop whiskers. “Can’t
say as ’ow I do. Sounds like the name of a ’oss.”
“Do you mean, my lad,” said the bald-headed man, “the number o’
the year a ’oss o’ the name of Hovvid won the Derby?”
“A ’oss o’ the name of Hovvid never did win the Derby,” said the
police constable with mutton-chop whiskers decisively.
“Ovid is one of the chief among the Roman authors,” said the boy.
For the moment everything else had yielded to the astonishment he
felt that all these imposing, austere, and strikingly-dressed street-
persons should not know who Ovid was.
“Get the directory, Harby,” said the bald-headed man, “and look up
the year in which Hovvid was born. You were right, Gravener; he is a
bit touched.”
“Coorse I’m right,” said Gravener. “Anybody with ’alf a heye can see
that.”
“Ovid was born in the year 43 before Christ,” said the boy. “The
number of the shop of my father is forty-three.”
“Then why couldn’t you say so at first, my lad, and save all this
parley?” said the bald-headed man sternly. “What’s in Number One,
Harby?”
“A drunk and incapable, and a petty larceny.”
“Better put him in there for to-night.”
The boy was led into a room somewhat similar to that in which his
clothes had been taken off. But this apartment seemed not only
larger and more cheerless, but also very much darker. The only
means by which daylight could get in was through a narrow window
high up in the wall, and this was barred with iron. The few beams
that were able to struggle through seemed merely to render
everything malign and hideous. The boy, who from his first hour in
the world had had an overpowering horror of the darkness,
shuddered in every vein when he discovered that he was alone, and
irrevocably committed to it for a nameless term. After the first trance
of his terror had passed he was able to discern that a settle ran
along the side of the wall. Hardly daring to move, he crept towards it.
As he did so he stumbled over something. It was warm and soft.
Something alive was lying on the floor. It was a shapeless mass. He
could hear it breathing.
He sank on to the settle at the side of the wall. He was inert and
stupefied. Great cold beads began to roll from his cheeks. He could
see and comprehend nothing. Under the dominion of his terror he
began to wish for death.
Quite suddenly a voice came out of the darkness.
“What ’ave they pinched you for, mate?” said a low growl in his ear.
He had not been conscious that any other living presence was in the
dark room, except that nameless something which was lying on the
floor. He was so startled that he gave a little shriek.
“Pipe up, cully,” said the low growl in his ear.
The boy’s teeth began to chatter furiously, but they emitted no
sounds that were coherent.
“Off his onion!” growled the voice, together with a string of blood-
curdling expressions, from which the boy was mercifully delivered
comprehension.
Presently the voice growled out of the darkness again.
“Got a chew, cully?”
The faculty of speech was still denied to the boy.
Further blood-curdling expressions followed from the other occupant
of the bench, who then relapsed into a morose silence.
The boy grew very cold. He trembled violently; yet his heart had
almost seemed to stop beating. The darkness and the silence and
the strangeness and the loneliness seemed to grow more intense.
His mind would hardly submit to the question of what had happened
to him. It refused to revert to his father and the little room. He felt that
he was never going to see them again.
After a while he slipped from the bench involuntarily. He found
himself on his knees on the cold stone floor. He clasped his hands
and pressed his eyes convulsively against the piece of wood on
which he had been sitting. He began to pray. There seemed to be
nothing else to do.
Two hours later a police constable entered and lit a feeble gas-jet
high up in the wall. It was protected by a cage of wire. He then gave
a kick to the breathing, shapeless thing without a name, which lay in
the middle of the stone floor.
With a leer of jocular malignity the occupant of the form pointed to
the kneeling figure of the boy.
“Off his onion, mate,” he said, with a low growl and expectorating
freely.
“Pity you ain’t,” said the police constable.
The occupant of the form spat upon the boots of the police
constable.
The police constable approached the boy, and said, with a sort of
rough kindness—
“You can have the Christian Herald, my lad, if you’d like it.”
The boy neither moved nor answered. He did not know that a word
had been spoken to him.
“Told yer, cully,” came the rough growl from the form. “He’s up the
pole.”
The police constable walked out of the cell with a greater show of
delicacy than that with which he had entered it.
An hour afterwards he came in again carrying two basins of thick
lukewarm gruel and a copy of the Christian Herald, two months out
of date. He found the boy to be still on his knees in the precise
attitude he was in when he entered before.
“Balmy!” growled the voice from the bench.
The police constable gave one basin of gruel to the speaker, and
placed the other basin and the copy of the Christian Herald at the far
end of the form, well out of the reach of its occupant.
The police constable touched the boy on the shoulder gently.
“Don’t want to disturb you, my lad,” he said, “but your supper’s
waiting for you when you want it. And I’ve brought you the Christian
Herald to cheer you up a bit.”
No sign came from the boy to suggest that he was conscious that he
had been addressed.
The police constable walked out of the cell on tiptoe.
The occupant of the form devoured his basin of gruel ravenously.
The sounds that he emitted in so doing were strongly reminiscent of
the lower animals. He then rose and fetched the other basin of gruel
from the end of the bench, together with the Christian Herald. He
placed the Christian Herald on the floor, and wiped his boots on it
with an odd kind of gusto. He then proceeded to devour the second
basin of gruel. Afterwards he placed his legs up on the bench, went
to sleep and snored lustily.
VII
The boy had no recollection afterwards of what occurred during the
long period which intervened between this hour and that remote one
in which he saw again his father’s face. How long the darkness
lasted and what happened in it he could not tell. He prayed
continuously until his flesh ached and his mind grew frail. Yet in the
midst of that which seemed to be without a limit, in the midst of an
anguish that seemed to have no end, it was borne in upon him that
the daylight had come back again.
Thereafter he had a vague knowledge of cold water, other rooms,
other voices, more light, and more air. At last he came to understand
that he was in the midst of a large place which contained many
street-persons who looked very solemn and wore no hats. Far away
in front of him he seemed to discern a high desk, at which was
seated an elderly street-person with grey hair, a shining bald head
and impressive manners. Seated on either side of him were a
number of women in gay and beautiful clothes. There was also a
number of those odd beings whom he had come to recognize as
police constables. And then quite suddenly he saw his father’s face.
The pale, noble and serene countenance was looking up at him. It
was pervaded by that secret and beautiful smile which the boy had
seen so many times upon it. With a little convulsive shudder of
recognition the boy started to run to his father, but as he made to do
so he awoke to the discovery that he was enclosed in a kind of cage.
“My father, my father!” the boy called out.
“Keep quiet,” said a police constable beside him in a rough whisper.
The elderly grey-haired man at the high desk lifted up his head in a
startled manner, and looked about him.
“Remove that man from the court,” he said.
He thrust out a finger straight at the boy’s father. With his heart
beating faint and small, the boy watched his father vanish out of his
ken. He passed out through a side door in the custody of two
immense police constables.
“My husband, Lord Pomeroy,” said a woman who sat next to the
elderly man with the grey hair and the impressive manners, “my
husband, Lord Pomeroy, is much displeased that my purse has been
stolen, and he would be here personally to express his displeasure
had he not been commanded to Windsor unexpectedly.”
These words, very loudly spoken, seemed to provoke a kind of joyful
flutter in the breasts of all present. Even in the breast of the boy it
provoked a flutter, yet not perhaps of a similar kind. It was the sound
of the loud and harsh voice itself which to him was of sinister omen.
As in an agony of remembrance he felt what this voice denoted, the
blood ran as water in his veins.
“I am sure, Lady Pomeroy,” said the man with grey hair in a most
silken manner, “in your misfortune you are entitled to every sympathy
from this court. May it trust that there was nothing of great value in
your purse.”
“Oh dear, dear no!” said the woman emotionally, “there was nothing
whatever in my purse, but I can’t live without it.”
“Quite so, just so,” said the man with grey hair. “The court
appreciates that perfectly. It feels you are entitled to every
sympathy.”
“Pray what is the use of sympathy, my dear good man,” said the
woman petulantly, “if it doesn’t restore my purse?”
“Precisely, dear Lady Pomeroy,” said the man with grey hair, “your
concern for your purse is most natural.”
At this stage in the proceedings the man with grey hair gave a kind
of benevolent signal to a sedulous-looking man, whose hair was very
glossy, who sat immediately opposite to him, and who at this
moment was engaged in sharpening a lead pencil.
“But, dear Lady Pomeroy,” said the man with grey hair, speaking
very slowly and with his eye fixed on the man opposite, “sympathy is
not necessarily barren, even if it is not fertile of visible result.”
Upon the utterance of these words, an extremely intellectual looking
police constable, who was stationed in the centre of the crowded
room, broke into a sudden and totally unexpected guffaw of laughter,
which he turned into a cough with equal suddenness and great
dexterity. His action incited the row of gaily dressed females to give
vent to a little melodious cackle. These in turn seemed to incite the
man who had been sharpening the lead pencil to write furiously. And
all these portents having assured the man with grey hair that his
memorable utterance had passed into history, he composed his
features into a form of polite expostulation that words so trivial
should have achieved that destiny.
Much passed between the woman with the loud voice and the man
with the grey hair and the impressive manners. All, however, went
unheeded by the boy; for during the whole of the time he stood
clutching at the wooden rail by which he was surrounded, in order to
save himself from measuring his length on the floor. To every other
person in the court, however, the intercourse of the woman with the
loud voice and the man with grey hair seemed to be fraught with a
high significance.
Presently the constable who stood beside the boy gave him a sharp
nudge.
“Now then,” he whispered truculently. “Pull yerself together. His
washup is a-speaking to you.”
The boy was able to observe that the man with grey hair and
impressive manners was wagging a short and fat forefinger in his
direction. He also appeared to be speaking with a kind of stern
deliberation, but the boy failed to appreciate a word that he said.
This homily, however, proceeded for some time; and in the course of
it all present were much impressed. The man with grey hair and
impressive manners concluded his discourse somewhat in this
fashion: “Owing to the humane clemency which has been exhibited
by Lady Pomeroy, a clemency, I may say, which is so familiar among
all grades of society as to stand in need of no advertisement from
this court”—(“Hear, hear,” in a suppressed but perfectly audible
whisper from a voice at the back)—“there is no undue desire to
press this charge. William Jordan, as this seems to be the first
occasion on which you have appeared before this court, and as I am
informed that no record of a previous conviction stands against your
name, you will at the express desire of Lady Pomeroy”—(“Hear,
hear,” from the voice at the back)—“be dealt with under the First
Offenders Act. After entering into recognizances to come up for
judgment if called upon, you will be discharged. It is deemed
advisable, however, that you should have an interview with the police
court missionary. In conclusion I hail this opportunity of tendering the
most sincere thanks of the public to Lady Pomeroy”—(“Hear, hear,”
from the back)—“for the public-spirited manner in which she has
come forward to discharge a duty which must have been peculiarly
distasteful to her.”
While the row of gaily dressed women rose wreathed in smiles, and
formed a cordon round the man with grey hair and impressive
manners, in order to shake hands with him, the boy was led into an
adjoining room. In the next instant he was shuddering convulsively in
the arms of his father.
A sad-looking man with cadaverous cheeks and sunken black eyes
came up to them. With an odd kind of compunction he laid his hand
on the boy’s sleeve.
“What is he doing here?” he said.
The boy’s father enfolded the questioner in his secret and beautiful
smile.
“You ask a question which admits of no answer,” he said.
At the sound of the voice of the boy’s father, the man with the
cadaverous cheeks recoiled a step. His sallow face flushed a little.
With the naïveté of a child he peered into the eyes of the boy’s
father.
“I think, sir,” he said, with a curiously humble gesture, “I think you are
perfectly right.”
VIII
From that time forward and for many days the boy did not venture
again out of the little room behind the shop. And at night he could not
bear to be out of his father’s company, so that he never went to bed
without him, but sat reading in the ancient authors, or staring into
vacancy with his chin propped on his hands. On some evenings after
the shutters of the shop had been put up at eight o’clock, and each
had partaken of his frugal supper, his father would take down from
the shelf on the wall the old and massive volume in which he read so
diligently.
The boy had never sought to read in this volume, because although
he had always viewed it with the greatest curiosity, and had even
seen when it lay open for his father’s perusal, that its pages of
vellum were covered in close and faded, and almost undecipherable
writing in red ink, he had felt instinctively from his father’s manner in
regard to it that the contents were only for his father’s eyes.
One night, however, long after the hour of midnight had chimed out
from the clocks of the neighbouring churches, and his father had
been reading in the old volume with a fidelity that seemed even
greater than his wont, the boy could stifle his curiosity no more. This
was owing to a strange incident that befell. Towards the dawn of the
summer morning, his father, who had not allowed his eyes to stray
from the book for many hours, rose from the table suddenly. There
was an expression upon his face that the boy had never seen
before.
His father went to the cupboard which was let into the wall, into
which, owing to some occult reason that had never even shaped
itself in his mind, the boy had never sought to peer. Therefrom he
took a knife which was contained in a case that was very old and
chased curiously, a chalice for the reception of ink, and a stylus.
Setting out these articles upon the table, his father took off his
threadbare coat, and laid his right arm naked to the elbow. He then
took the knife from the case and plunged it into the flesh. As the red
blood spurted forth and dripped into the chalice, the boy gave an
exclamation of horror and dismay.
“If you have not yet the power, Achilles, to withstand this spectacle,”
said his father in that voice which never failed to calm his most
instant fears, “pray turn your eyes away.”
Although the boy was on the verge of swooning, for such a sight
bereft him of his strength, he continued to look at his father in sore
distress.
After his father had allowed a quantity of blood to pass into the
chalice, he swathed the wound in his arm in a linen band, opened a
blank page in the book, and sat down before it, stylus in hand.
He dipped the pen in the red fluid; he poised it over the page. For a
long time he maintained this attitude, yet not a mark of any kind did
the fingers trace on the vellum. At last with a gesture of profound
anguish, which filled the youthful witness with terror, he rose, and a
kind of moan came from his lips.
“It is not to be!” he muttered.
The fire in the grate was still smouldering, and into this the boy’s
father cast the contents of the chalice. Then with a religious care he
cleansed each of the articles he had taken from the cupboard, and
replaced them there.
“Is it that you cannot write in the book, my father?” asked the boy,
whose lips were pale.
“Yes, beloved one, it is not yet given to me to write in the book,” said
his father, with an expression of indescribable agony upon his face.
“And yet my years are now beyond three score.”
“Is it that you have never written in the book, my father?” asked the
boy in his consternation.
“I have never written in the book, Achilles,” said his father. “And I
dare not measure the failures I have made.”
“Is it the book of the Fates, my father, in which every human person
must write his destiny?” asked the boy.
“No, beloved one,” said his father. “It is not the book of the Fates.
Only the bearers of our name can write in this book. And these have
written in it for a thousand years past.”
“What is our name, my father?” said the boy. “I have been asked for
it on several occasions by the persons in the streets.”
“Our name is William Jordan—yours and mine.”
“William Jordan, William Jordan,” repeated the boy softly. A look of
strange disappointment crept into his face. “William Jordan!” he said,
“William Jordan!”
“What’s in a name, beloved one?” said his father, with his secret and
beautiful smile.
Under his father’s patient eyes the look of strange disappointment
passed from the boy’s face.
“And each bearer of our name, my father, must write in this book?”
said the boy.
“It is so decreed,” said his father. “And for a thousand years past
each of our dynasty has done so, with the exception, Achilles, of you
and me.”
The boy’s heart began to beat wildly.
“Then I, too, must write in it, my father?”
As he spoke the frail and gaunt form shook like gossamer.
“We can but fulfil our destiny, beloved one,” said the boy’s father.
“And it is written that when a bearer of our name ceases to write in
the Book of the Ages our dynasty is at an end.”
IX
One day the boy discovered that a small brown volume, the Phaedo
of Plato, had disappeared from one of the shelves in the shop.
“I bartered it yesterday, beloved one, in exchange for seven shillings
and sixpence in silver,” said his father in reply to his inquiries.
This unexpected and disconcerting answer made many anxious
questions necessary.
“Why, my father, for what reason?” said the boy.
“In order to provide the means of life, beloved one,” said his father.
“The means of life, my father?” said the boy.
“The food we eat,” said his father. “Our clothes, the roof that protects
us, the coals for the fire in the winter months.”
“Are all these things obtained with pieces of silver, my father?”
“Yes, beloved. We are called upon to pay in substance for all that we
enjoy.”
The boy grew profoundly silent for a while.
“Does that mean, my father,” he said at last, in a choking voice, “that
because we enjoy this little room of ours, we purchase the priceless
hours we spend in it by pieces of silver—you and me?”
“Truly,” said his father.
“And yet, my father,” said the boy, “I have no pieces of silver of my
own except those you used to give me when I went forth into the
streets of the great city to the school. Neither have I books of my
own to yield in exchange for pieces of silver. Can you tell me in what
manner I must gain these things? You know, my father,” he added
very anxiously, “it may befall that this little room might one day be
taken away from me, as it once was before, if I do not obtain some
pieces of silver of my own.”
“There is but one means of obtaining pieces of silver, beloved one,”
said his father mournfully, “and that is by going forth to seek them in
the streets of the great city.”
The boy was smitten with stupefaction by these words. They were
charged with an import that he did not know how to sustain. But at
least they caused a cloud to dissolve which had long pervaded his
mind.
“I see, I see,” he said weakly; “now it is that I understand, my father,
what all these street-persons are doing when they walk so furiously
up and down the streets of the great city. They are seeking for
pieces of silver.”
“Yes, beloved,” said his father.
“And it is for that reason that they look so fierce and so cruel, my
father. They know that if they don’t find some pieces of silver their
little rooms will be taken away from them.”
“Yes, beloved one,” said his father.
“How unhappy they must be, my father, those persons in the streets
of the great city,” said the boy. “We ought to give them our pity
instead of our fear and our hatred. But”—his voice seemed to perish
—“does it not mean, my father, that I also must go forth once more
into the great city and become a person in the streets?”
As he framed this sinister question he peered into his father’s eyes
with a look of entreaty, as though he besought him not to answer in
the manner that he feared to be inevitable.
“You have spoken truly, Achilles,” said his father gently.
The words of his father seemed to embody a sentence of death. His
father perceived in what manner he was stricken.
“You see, beloved one,” he said, holding the slight frame against his
bosom, “nothing whatever can be obtained in this world which for a
term we are doomed to inhabit, except by the medium of pieces of
silver. The food that sustains us, the clothes that shield us, the roof
that defends us, can only be purchased by pieces of silver. Even
these heroes, whom you and I consider the first among created
things, had to collect many pieces of silver before they could acquire
the materials, and the leisure to perform their most signal acts.”
“And, my father,” said the boy, “had they not always to have their
little rooms in which to read the ancient authors and to seek their
knowledge?” He shuddered with a kind of passion. “Yes, indeed, I
must go out into the streets of the great city and find some pieces of
silver,” he said.
X
The boy was visited by little sleep that night and for many nights to
follow. The necessity of adventuring forth again into those streets,
the recollection of which ever haunted him like a diabolical vision,
was at first more than he could endure. Many were the attempts he
made to fare forth yet again, but on every occasion he would turn
back all stricken by distress after essaying less than a hundred
yards. Yet at each failure the stern need of conquering this
deplorable frailty would address him like a passion; and sometimes
with a sense of dire humiliation he would be moved to take counsel
of his father.
“How, my father, can I make myself obey myself?” was a question he
asked many times.
It was not until his father had pondered deeply on this subject that he
vouchsafed a reply. And then at last he said, “I fear, beloved, that in
your present phase there is only one answer I can give to your
question. I fear it will be necessary for you to obtain a little
knowledge in the practical sciences before the power will be
furnished for you to move out in courage and security into the streets
of the great city. Beloved, we will devote a whole year to this study,
and we will conduct it together.”
During that evening, to the boy’s astonishment, his father went out
into the street and brought back a newspaper, an article the boy had
never seen in his hand before.
“This is the Alpha and the Omega, beloved one, of that strange world
whose mysteries you deem it to be your duty to penetrate,” said his
father, with his secret and beautiful smile.
From that time forward the boy’s evenings were no longer given up
to desultory readings in the ancient authors. He bestowed many
painful and irksome hours upon the newspaper; and these would
have been intolerable had not his labours had the sanction of his
father’s patient exposition. Day by day its most obscure mysteries
were unfolded to him. Yet the more knowledge he acquired the
greater his repugnance became. “I hate it! I hate it!” he cried
sometimes, with tears in his eyes.
There was another means also by which his father sought to
increase his knowledge of the practical sciences. He would
accompany him daily into the streets at all hours of the morning,
afternoon and evening. He made him familiar with many labyrinths
among the highways and byways of the great city. He gave him an
insight into many obscure methods of acquiring pieces of silver. He
would denote the character of individual persons as they passed by;
and above all, he strove to make the boy familiar with the language
that was in daily use about him, and with the plane of ideas of those
who used it.
In the course of one of these daily lessons his father pointed out a
boy kneeling at the edge of the pavement with a box before him,
some brushes and a pot of blacking.
“That boy, beloved one,” said his father, “maintains his place in the
scheme by removing the mud from the boots of the passers-by.
Observe him now cleansing those of the man in the tall bright hat.
For so doing he will be rewarded with a small piece of silver, and
with that piece of silver he will obtain food and a roof for his head.”
“I don’t understand, my father, I don’t understand,” said the boy in
deep perplexity. “If the man in the tall bright hat gives away to others
the pieces of silver he possesses because he is too proud to bear a
little mud on his boots, how can he obtain food for himself, and how
can he sustain the little room in which he dwells?”
“We will follow in the footsteps of that man,” said his father, “and
seek to find out the means by which he gains his own pieces of silver
in such profusion.”
For many weeks the boy’s education in the practical sciences was
conducted in this fashion; and although at first he lived in a state of
deep perplexity, and was often overcome by the feeling that he
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like