Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
CHAPTER 1 Introducing JavaServer Pages The Java 2 Enterprise Edition (J2EE) has taken the once-chaotic task of building an Internet presence and transformed it to the point where developers can use Java to efficiently create multitier, server-side applications. Today, the Java Enterprise APIs have expanded to encompass a number of areas: RMI and CORBA for remote object handling, JDBC for database interaction, JNDI for accessing naming and directory services, Enterprise JavaBeans for creating reusable business components, JMSTM (Java Messaging Service) for message-oriented middleware, JAXPTM for XML processing, and JTATM (Java Transaction API) for performing atomic transactions. In addition, J2EE also supports servlets, an extremely popular Java substitute for CGI scripts. The com- bination of these technologies allows programmers to create distributed business sol- utions for a variety of tasks. In late 1999, Sun Microsystems added a new element to the collection of Enterprise Java tools: JavaServer Pages (JSP). JavaServer Pages are built on top of Java servlets and are designed to increase the efficiency in which programmers, and even nonprogram- mers, can create web content. This book is primarily about JavaServer Pages, covering the latest version of this technology, JSP 1.2, as well as the related JSP Standard Tag Library (JSTL) Version 1.0. It also covers other J2EE technologies, such as servlets and JDBC, with focus on how to combine them with JSP in the most efficient way. What Is JavaServer Pages? Put succinctly, JavaServer Pages is a technology for developing web pages that include dynamic content. Unlike a plain HTML page, which contains static content that always remains the same, a JSP page can change its content based on any number of variable items, including the identity of the user, the user's browser type, information provided by the user, and selections made by the user. As you'll see later in the book, this func- tionality is key to web applications such as online shopping and employee directories, as well as for personalized and internationalized content. A JSP page contains standard markup language elements, such as HTML tags, just like a regular web page. However, a JSP page also contains special JSP elements that allow 3