Before You Begin

Building Web Components provides essential information for anyone involved in the creation of web applications with Javatrademark 2 Platform, Enterprise Edition (J2EEtrademark) web components. It is part of the Suntrademark ONE Studio 5 Programming series. This book focuses on web application development in the context of the J2EE and its supporting technologies. These technologies include Java servlets and JavaServer Pagestrademark (JSPtrademark).

This book introduces web applications and provides suggestions for their structure. It describes the work flow of developing a web application. The book proposes design practices and provides pointers to suggested structures and frameworks for scalable, maintainable web applications. It places these concepts within the context of the Sun ONE Studio 5 integrated development environment (IDE) with discussions of the creation of JSP pages and servlets, coding, testing, debugging, and deployment.

In particular, this book describes how web applications typically use JSP pages, Java servlets, JSP tag libraries, and supporting classes and files. Web applications might use persistent data, for example, a database. They could be independent applications with features managed by a web container. Or, they might provide a user interface while depending on components in a J2EE Enterprise JavaBeans (EJBtrademark) container for other services. Such services might include execution of business logic and access to persistent data.

See the release notes for a list of environments in which you can create the examples in this book. The release notes are available on this web page:

http://forte.sun.com/ffj/documentation/index.html

Screen shots vary slightly from one platform to another. Although almost all procedures use the interface of the IDE, occasionally you might be instructed to enter a command at the command line. Here too, there are slight differences from one platform to another. For example, a Microsoft Windows command might look like this:

c:>cd MyWorkDir\MyPackage

To translate for UNIX® platforms or Linux platforms, change the prompt and use forward slashes:

% cd MyWorkDir/MyPackage


Before You Read This Book

This book assumes you are a web application developer or a web application designer. A web application developer writes the application code. A web application designer specifies how users interact with an application, chooses interface components, and arranges them in a set of views. Unless otherwise stated, this book uses the term web application to refer to a J2EE web application. The web application developer might or might not be the same person as the web application designer. In either case, it is assumed you have a general knowledge of Java programming, JSP page programming, and HTML coding. Information in this book might also prove useful for any professionals who participate in the creation of applications based on web components. Such professionals might include technical writers, graphic artists, production and marketing specialists, and testers. This book presents the ways in which web application development work flow is facilitated by the use of the IDE. It provides a context in which to use this productivity tool.

The development of web applications differs markedly from that of traditional Java applications. It requires an understanding of several different technologies. Before starting, you should be familiar with the following subjects:

  • HTML syntax
  • XML syntax
  • Javatrademark programming language
  • Java Servlet syntax
  • JavaServer Pagestrademark syntax
  • HTTP protocol
  • Web server concepts
  • Security issues

This book enables you to use your current skills. It also provides you with references to help you become productive in the building of web applications with the IDE.

This book requires a knowledge of J2EE concepts, as described in the following resources:

Familiarity with the Java API for XML-Based RPC (JAX-RPC) is helpful. For more information, see this web page:

http://java.sun.com/xml/jaxrpc

The Sun ONE Studio 5 Web Application Tutorial can be downloaded from the Developer Resources web site. To gain access to the tutorial, choose Help, then Learning, then Examples, then Tutorials/Examples from the IDE's main menu.

The J2EE Tutorial describes the process of developing web applications. Visit the web site at:

http://java.sun.com/j2ee/tutorial

The Java Web Services Tutorial provides helpful background. It could prove useful as a reference while reading this book. Available at:

http://java.sun.com/webservices/docs/1.0/tutorial/



Note - Sun is not responsible for the availability of third-party web sites mentioned in this document and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. Sun will not be responsible or liable for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods, or services available on or through any such sites or resources.




How This Book Is Organized

Building Web Components contains the following information:

Chapter 1 provides an introduction to web applications and the challenges they present to developers. It describes the ways that the IDE helps the developer face those challenges.

Chapter 2 discusses the structure of web applications. It includes an overview of the core J2EE technologies used in building the components of web applications.

Chapter 3 gives an overview of useful design patterns and frameworks for web applications.

Chapter 4 describes the process of developing your own web application using the IDE.

Chapter 5 provides details on the process of executing, debugging, and deploying your web application using the IDE.

The Glossary defines important words and phrases found in the book. Glossary terms appear in italics throughout the book.


What Is Not in This Book

This book is intended to provide sufficient information to get you started using the IDE as a productivity tool. However, it is not designed as a tutorial. The book is neither a comprehensive reference, nor does it supply all possible designs for a web application. It is not a visual design guide. Nor is the focus on developing the J2EE web tier. The book does not delve into how to develop EJB components. See Useful References for suggested readings. See Before You Read This Book for references to tutorials regarding the development of web applications.


Useful References

This section provides the names of references you might find helpful when reading this book.

This volume covers topics related to web application design and implementation:

Alur, Deepak, Crupi, John, and Malks, Dan, Core J2EE Patterns, Sun Microsystems Press, Prentice Hall, 2001. This excellent book on web application architecture and models provides solutions, including J2EE-based answers, to problems in context. It reflects the collective experience of Java architects and the Sun Java Center.

Valuable Web Sites

Here is a selection of web sites dealing with web application technologies:

  • The Source for Java Technology provides a wealth of information on web component technologies. Topics include products and APIs, access to the Developer Connection, documentation and training, and online support. It also supplies community discussion, industry news, marketplace solutions, and case studies. Available at http://java.sun.com
  • JSP Insider is a JavaServer Page web site offering design information, articles, code, links to other web site, news stories, and book reviews. Available at http://www.jspinsider.com
  • The JSP Resource Index is a place to find tutorials, scripts, and even job listings. Available at http://www.JSPin.com
  • The Jakarta Project supplies commercial-quality server solutions based on the Java platform that are developed in an open and cooperative fashion. Jakarta is the overall project name for many subprojects, including the Jakarta tag libraries and the Tomcat server. Available at http://jakarta.apache.org
  • TheServerSide.com is a J2EE news source and developer community. Available at http://www.theserverside.com.


Typographic Conventions

Typeface

Meaning

Examples

AaBbCc123

The names of commands, files, and directories; on-screen computer output

Edit your .cvspass file.

Use DIR to list all files.

Search is complete.

AaBbCc123

What you type, when contrasted with on-screen computer output

> login

Password:

AaBbCc123

Book titles, new words or terms, words to be emphasized

Read Chapter 6 in the User's Guide.

These are called class options.

You must save your changes.

AaBbCc123

Command-line variable; replace with a real name or value

To delete a file, type DEL filename.



Related Documentation

Sun ONE Studio 5 documentation includes books delivered in Acrobat Reader (PDF) format, release notes, online help, readme files for example applications, and Javadoctrademark documentation.

Documentation Available Online

The documents described in this section are available from the docs.sun.comSM web site and from the documentation page of the Sun ONE Studio Developer Resources portal at http://forte.sun.com/ffj/documentation.

The docs.sun.com web site (http://docs.sun.com) enables you to read, print, and buy Sun Microsystems manuals through the Internet. If you cannot find a manual, see the documentation index that is installed with the product on your local system or network.

  • Release notes (HTML format)
Available for each Sun ONE Studio 5 edition. Describe last-minute release changes and technical notes.
    • Sun ONE Studio 5, Standard Edition Release Notes - part no. 817-2337-10
  • Getting Started guides (PDF format)
Describe how to install the Sun ONE Studio 5 integrated development environment (IDE) on each supported platform and include other pertinent information, such as system requirements, upgrade instructions, application server information, command-line switches, installed subdirectories, database integration, and information on how to use the Update Center.
    • Sun ONE Studio 5, Standard Edition Getting Started Guide - part no. 817-2318-10
    • Sun ONE Studio 4, Mobile Edition Getting Started Guide - part no. 817-1145-10
  • Sun ONE Studio 5 Programming series (PDF format)
This series provides in-depth information on how to use various Sun ONE Studio 5 features to develop well-formed J2EE applications.
    • Building Web Components - part no. 817-2334-10
Describes how to build a web application as a J2EE web module using JSP pages, servlets, tag libraries, and supporting classes and files.
    • Building J2EE Applications - part no. 817-2327-10
Describes how to assemble EJB modules and web modules into a J2EE application and how to deploy and run a J2EE application.
    • Building Enterprise JavaBeans Components - part no. 817-2330-10
Describes how to build EJB components (session beans, message-driven beans, and entity beans with container-managed persistence or bean-managed persistence) using the Sun ONE Studio 5 EJB Builder wizard and other components of the IDE.
    • Building Web Services - part no. 817-2324-10
Describes how to use the Sun ONE Studio 5 IDE to build web services, to make web services available to others through a UDDI registry, and to generate web service clients from a local web service or a UDDI registry.
    • Using Java DataBase Connectivity - part no. 817-2332-10
Describes how to use the JDBC productivity enhancement tools of the Sun ONE Studio 5 IDE, including how to use them to create a JDBC application.
  • Sun ONE Studio 5 tutorials (PDF format)
These tutorials demonstrate how to use the major features of Sun ONE Studio 5, Standard Edition:
    • Sun ONE Studio 5 Web Application Tutorial - part no. 817-2320-10
Provides step-by-step instructions for building a simple J2EE web application.
    • Sun ONE Studio 5 J2EE Application Tutorial - part no. 817-2322-10
Provides step-by-step instructions for building an application using EJB components and web services technology.
    • Sun ONE Studio 4, Mobile Edition Tutorial - part no. 816-7873-10
Provides step-by-step instructions for building a simple application for a wireless device, such as a cellular phone or personal digital assistant (PDA). The application you build is compliant with the Java 2 Platform, Micro Edition (J2MEtrademark platform) and conforms to the Mobile Information Device Profile (MIDP) and Connected, Limited Device Configuration (CLDC).

You can also find the completed tutorial applications at: http://forte.sun.com/ffj/documentation/tutorialsandexamples.html

Online Help

Online help is available in the Sun ONE Studio 5 IDE. You can open the help by pressing the help key (F1 in Microsoft Windows and Linux environments, Help key in the Solaris environment), or by choosing Help right arrow Contents. Either action displays a list of help topics and a search facility. In particular, you should explore the JSP/Servlet help set and the help sets for the supported server software.

Examples

You can download examples that illustrate a particular Sun ONE Studio 5 feature, as well as completed tutorial applications, from the Sun ONE Studio Developer Resources portal at:

http://forte.sun.com/ffj/documentation/tutorialsandexamples.html

Javadoc Documentation

Javadoc documentation is available within the IDE for many Sun ONE Studio 5 modules. Refer to the release notes for instructions on installing this documentation.

Documentation in Accessible Formats

The documentation is provided in accessible formats that are readable by assistive technologies for users with disabilities. You can find accessible versions of documentation as described in the following table.

Type of Documentation

Format and Location of Accessible Version

Books and tutorials

HTML at http://docs.sun.com

Mini-tutorials

HTML at http://forte.sun.com/ffj/tutorialsandexamples.html

Integrated example readmes

HTML in the example subdirectories of s1studio-install-directory/examples

Release notes

HTML at http://docs.sun.com



Contacting Sun Technical Support

If you have technical questions about this product that are not answered in this document, go to:

http://www.sun.com/service/contacting


Sun Welcomes Your Comments

Sun is interested in improving its documentation and welcomes your comments and suggestions. Email your comments to Sun at this address:

docfeedback@sun.com

Please include the part number (817-2334-10) of your document in the subject line of your email.