xx WebSphere Studio Application Developer Version 5 Programming Guide Trademarks The following terms are trademarks of the International Business Machines Corporation in the United States, other countries, or both: AIX® BookMaster® Cloudscape™ CICS® Domino™ DB2® ™ ^™ Informix® IBM® ibm.com® IMS™ Lotus® Notes® Redbooks™ Redbooks (logo) ™ SAA® VisualAge® WebSphere® z/OS® 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. © Copyright IBM Corp. 2003. All rights reserved. xxi 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 xxii WebSphere Studio Application Developer Version 5 Programming Guide 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. 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. Ian Maik Ueli Fabio Henrik Preface xxiii 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 xxiv WebSphere Studio Application Developer Version 5 Programming Guide 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: redbook@us.ibm.com Mail your comments to: IBM Corporation, International Technical Support Organization Dept. HZ8 Building 662 P.O. Box 12195 Research Triangle Park, NC 27709-2195 Preface xxv 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 ) xxvi WebSphere Studio Application Developer Version 5 Programming Guide © Copyright IBM Corp. 2003. All rights reserved. 1 Part 1 Introducing WebSphere Studio Part 1 introduces WebSphere Studio Application Developer with concepts about the Workbench, tools, workspace, perspectives, and projects. Part 1 2 WebSphere Studio Application Developer Version 5 Programming Guide © Copyright IBM Corp. 2003. All rights reserved. 3 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 Too ls Sample code in this book 1 . SG24-6 957 -00 for WebSphere Studio Application Developer Version 5 Programming Guide as created or updated on July 16, 20 03. July 20 03, First Edition This book is a major rewrite of WebSphere Studio. of WebSphere Studio Application Developer Programming Guide , SG24- 658 5. The previous book was based on Application Developer Version 4, this book is based on Version 5. This revision reflects. The Java Developer s Guide to Eclipse (see “Other publications” on page 818 ) xxvi WebSphere Studio Application Developer Version 5 Programming Guide © Copyright IBM Corp. 20 03. All rights