Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Introduction to WebObjects J2EE Programming Guide
JavaServer Pages (JSP) and servlets are important parts of Sun’s J2EE (Java 2 Platform, Enterprise Edition) architecture. JSP is a specification that defines interfaces that servlet-container vendors can implement to provide developers the ability to create dynamic Web pages, which are files with the extension
.jsp. Servlet containers interpret these files and create servlets (also know as workhorse servlets) to process HTTP requests and produce responses. Servlets are server plug-ins that extend the capabilities of your Web server. They provide a straightforward deployment mechanism for your applications. Servlets are deployed inside servlet containers, which are plug-ins to your Web server.
You should read this document if you want to deploy your WebObjects applications inside a servlet container or want to take advantage of WebObjects components (both standard and custom) in your JSP pages.
Deploying WebObjects applications as servlets allows you to take advantage of the features that your servlet container provides. Keep in mind that deployment tools such as Monitor and wotaskd do not work with servlets. WebObjects uses version 2.2 of the Servlet API, and version 1.1 of the JSP specification.
Organization of This Document
The document addresses two major points, each contained in its own chapter:
“Servlets” explains how you develop WebObjects applications to be deployed as servlets and how to add servlet capability to existing applications.
“JavaServer Pages” tells you how to write JSP-based applications, which can be thought of as JSP applications that use WebObjects technology or hybrids—applications that use JSP pages to accomplish some tasks and WebObjects components or direct actions to perform others.
“Special Issues” addresses special issues to consider when you deploy WebObjects applications as servlets or when you develop JSP-based applications.
“Document Revision History” lists the revisions made to this document.
To get the most out of this document, you must be familiar with WebObjects application development. In particular, you need to know how to create applications using Project Builder and how to layout WebObjects components using WebObjects Builder.
For additional WebObjects documentation and links to other resources, visit http://developer.apple.com/webobjects.
In addition to WebObjects development experience, you also need to be acquainted with the syntax used in JSP pages and with the layout of WAR (Web Application Archive) files. You can find information about JSP and J2EE in the following documents:
Java Servlet Programming, 2nd edition (O’Reilly) provides an in-depth treatise on servlets. You can find more information at http://java.oreilly.com.
J2EE Technology in Practice (Sun) provides an overview of J2EE technology.
JavaServer Pages Technology Syntax (Sun) is a short document that describes the syntax used in JSP pages. You can download it from http://java.sun.com/products/jsp/technical.html. For more information on JSP and servlets, see http://java.sun.com/products/jsp.
Java Servlet Technology contains the latest information on Sun’s Java Servlet technology. You can view it at http://java.sun.com/products/servlet/.
WebObjects Developer also includes a commented application project that shows you how JSP pages can take advantage of WebObjects components and direct actions. The example—using the client/server approach—includes two WebObjects application projects named SchoolToolsClient and SchoolToolsServer. The projects are located at
The three servlet containers supported in WebObjects are listed in Table I-1.
© 2002, 2005 Apple Computer, Inc. All Rights Reserved. (Last updated: 2005-08-11)