 2005 Pearson Education, Inc. All rights reserved. 1 26 Servlets.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Servlets and Java Server Pages.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 24: Servlets Outline 24.1 Introduction 24.2 Servlet Overview and Architecture Interface.
J.Sant Servlets Joseph Sant Sheridan Institute of Technology.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 21 – Web Servers (IIS and Apache) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3 System.
MC365 Application Servers: Servlets. Today We Will Cover: What a servlet is The HTTPServlet and some of its more important methods How to configure the.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
An introduction to Java Servlet Programming
Web Servers How do our requests for resources on the Internet get handled? Can they be located anywhere? Global?
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 34 Servlets.
Enhancing a Web Server with Servlets. Servlets Here focus on both sides of a client-server relationship. The client requests that some action be performed.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Servlets. Our Project 3-tier application Develop our own multi-threaded server Socket level communication.
Michael Brockway Application Integration Servlets l Introduction & Overview l HTTP Servlets l HTTP get Requests l HTTP post Requests l Multi-tier Applications.
SE-2840 Dr. Mark L. Hornick1 Java Servlet-based web apps Servlet Architecture.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 37 - JavaServer Pages (JSP): Bonus for Java Developers Outline 37.1 Introduction 37.2 JavaServer.
Java Server Pages B.Ramamurthy. Topics for Discussion 8/20/20152 Inheritance and Polymorphism Develop an example for inheritance and polymorphism JSP.
Introduction to servlet programming Pertemuan 6 Matakuliah: Web Programming Tahun: 2009.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 29.1 Multi-Tier Architecture 29.2 Web Servers.
1 Web Server Concepts Dr. Awad Khalil Computer Science Department AUC.
Java Servlets CS-422. Application Mapping Your servlet application will be mapped to a directory structure: –“myapp” maps to some directory C:/docs/apps/myapp.
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
Objectives Java Servlet Web Components
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 30 - Servlets: Bonus for Java Developers Outline 30.1 Introduction 30.2 Servlet Overview and.
111 Java Servlets Dynamic Web Pages (Program Files) Servlets versus Java Server Pages Implementing Servlets Example: F15 Warranty Registration Tomcat Configuration.
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 21 - Web Servers (IIS, PWS and Apache) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3.
CMPUT 391 – Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems Web based Applications,
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
Java Servlets Outline 24.1 Introduction 24.2 Servlet Overview and Architecture Interface Servlet and the Servlet Life Cycle HttpServlet Class.
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
Java Servlets & Java Server Pages Lecture July 2013.
1 Welcome to CSC 301 Web Programming Charles Frank.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
Introduction to Server-Side Web Development Introduction to Server-Side Web Development Session II: Introduction to Server-Side Web Development with Servlets.
L.MARIA MICHAEL VISUWASAM UNIT-4
1 Web Servers (Chapter 21 – Pages( ) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3 System Architecture.
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
 2002 Prentice Hall. All rights reserved. 9.8 Multi-Tier Applications: Using JDBC from a Servlet Three-tier distributed applications –User interface –Business.
Middleware 3/29/2001 Kang, Seungwoo Lee, Jinwon. Description of Topics 1. CGI, Servlets, JSPs 2. Sessions/Cookies 3. Database Connection(JDBC, Connection.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 24: Servlets Outline 24.1 Introduction 24.2 Servlet Overview and Architecture Interface.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, Responds oriented other.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 21 Java Servlets Wed. 11/22/00 based on material.
 2003 Prentice Hall, Inc. All rights reserved Deploying a Web Application ( may include.war )
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Servlets Outline 1 Introduction 2 Servlet Overview and Architecture 2.1 Interface Servlet and the Servlet Life Cycle 2.2 HttpServlet Class 2.3 HttpServletRequest.
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
CS3220 Web and Internet Programming Introduction to Java Servlets
Servlets.
Java Servlets By: Tejashri Udavant..
IS333D: MULTI-TIER APPLICATION DEVELOPMENT
MSIS 655 Advanced Business Applications Programming
Chapter 26 Servlets.
Servlet APIs Every servlet must implement javax.servlet.Servlet interface Most servlets implement the interface by extending one of these classes javax.servlet.GenericServlet.
COP 4610L: Applications in the Enterprise Spring 2005
COP 4610L: Applications in the Enterprise Spring 2005
COP 4610L: Applications in the Enterprise Spring 2005
CS3220 Web and Internet Programming Introduction to Java Servlets
J2EE Lecture 1:Servlet and JSP
Web Servers (IIS and Apache)
Java Chapter 7 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

 2005 Pearson Education, Inc. All rights reserved Servlets

 2005 Pearson Education, Inc. All rights reserved. 2 A fair request should be followed by the deed in silence. — Dante Alighieri The longest part of the journey is said to be the passing of the gate. — Marcus Terentius Varro If nominated, I will not accept; if elected, I will not serve. — General William T. Sherman Friends share all things. — Pythagoras

 2005 Pearson Education, Inc. All rights reserved. 3 OBJECTIVES In this chapter you will learn:  How servlets can be used to extend a Web server's functionality.  The servlet life cycle.  To execute servlets with the Apache Tomcat server.  To be able to respond to HTTP requests from an HttpServlet.  To be able to redirect requests to static and dynamic Web resources.  To use JDBC from a servlet.

 2005 Pearson Education, Inc. All rights reserved Introduction 26.2 Servlet Overview and Architecture Interface Servlet and the Servlet Life Cycle HttpServlet Class HttpServletRequest Interface HttpServletResponse Interface 26.3 Setting Up the Apache Tomcat Server 26.4 Handling HTTP get Requests Deploying a Web Application 26.5 Handling HTTP get Requests Containing Data 26.6 Handling HTTP post Requests 26.7 Redirecting Requests to Other Resources 26.8 Multitier Applications: Using JDBC from a Servlet 26.9 Welcome Files Wrap-Up Internet and Web Resources

 2005 Pearson Education, Inc. All rights reserved Introduction Java networking capabilities – Socket-based and packet-based communications Package java.net – Remote Method Invocation (RMI) Package java.rmi – Common Object Request Broker Architecture (COBRA) Package org.omg – Remote Method Invocation over the Internet Inter-Orb Protocol (RMI-IIOP)

 2005 Pearson Education, Inc. All rights reserved Introduction (Cont.) Client-server relationship – Servlets and JavaServer Pages (JSP) Request-response model Packages javax.servlet javax.servlet.http javax.servlet.jsp javax.servlet.tagext Common implementation of request-response model – Web browsers and Web servers Form the Web components of J2EE

 2005 Pearson Education, Inc. All rights reserved Introduction (Cont.) Thin clients – Provide presentation – Do not process data – Require fewer computing resources

 2005 Pearson Education, Inc. All rights reserved Introduction (Cont.) Apache Jakarta Project and the Tomcat Server Tomcat – Jakarta project – Official reference implementation of the JSP and servlet standards

 2005 Pearson Education, Inc. All rights reserved Servlet Overview and Architecture Servlet – Small portion of the content is static text or markup – Do not produce content – Perform a task on behalf of the client JavaServer Pages – Extension of servlet technology – Most of the content is static text or markup – Small portion of the content is generated dynamically Servlet container (servlet engine) – Server that executes a servlet

 2005 Pearson Education, Inc. All rights reserved Servlet Overview and Architecture (Cont.) Web servers and application servers – Sun Java System Application Server – Microsoft’s Internet Information Server (IIS) – Apache HTTP Server – BEA’s WebLogic Application Server – IBM’s WebSphere Application Server – World Wide Web Consortium’s Jigsaw Web Server

 2005 Pearson Education, Inc. All rights reserved. 11 Fig | Servlet architecture.

 2005 Pearson Education, Inc. All rights reserved Interface Servlet and the Servlet Life Cycle Interface Servlet – All servlets must implement this interface – All methods of interface Servlet are invoked by servlet container Servlet life cycle – Servlet container invokes the servlet’s init method – Servlet’s service method handles requests – Servlet’s destroy method releases servlet resources when the servlet container terminates the servlet Servlet implementation – GenericServlet – HttpServlet

 2005 Pearson Education, Inc. All rights reserved. 13 Software Engineering Observation 26.1 Servlets implement the Servlet interface of package javax.servlet.

 2005 Pearson Education, Inc. All rights reserved. 14 Fig | Servlet interface methods.

 2005 Pearson Education, Inc. All rights reserved Interface Servlet and the Servlet Life Cycle (Cont.) Interface Servlet implementation – GenericServlet Abstract class Package javax.servlet Protocol-independent servlet – HttpServlet Abstract class Package javax.servlet.http Use the HTTP protocol to exchange information Key method service – ServletRequest and ServletResponse

 2005 Pearson Education, Inc. All rights reserved HttpServlet Class Overrides method service Two most common HTTP request types – get requests Get/retrieve information from server – post requests Post/send data to server Method doGet responds to get requests Method doPost responds to post requests HttpServletRequest and HttpServletResponse objects

 2005 Pearson Education, Inc. All rights reserved. 17 Fig | HttpServlet class’s other methods.

 2005 Pearson Education, Inc. All rights reserved. 18 Software Engineering Observation 26.2 Do not override method service in an HttpServlet subclass. Doing so prevents the servlet from distinguishing between request types.

 2005 Pearson Education, Inc. All rights reserved HttpServletRequest Interface Servlet container – creates an HttpServletRequest object – passes it to the servlet’s service method HttpServletRequest object – contains the request from the client – provides methods that enable the servlet to process the request

 2005 Pearson Education, Inc. All rights reserved. 20 Fig | HttpServletRequest methods.

 2005 Pearson Education, Inc. All rights reserved HttpServletResponse Interface Servlet container – creates an HttpServletResponse object – passes it to the servlet’s service method HttpServletResponse object – provides methods that enable the servlet to formulate the response to the client

 2005 Pearson Education, Inc. All rights reserved. 22 Fig | HttpServletResponse methods.

 2005 Pearson Education, Inc. All rights reserved Setting Up the Apache Tomcat Server Download Tomcat (version ) – apache.towardex.com/jakarta/ tomcat-5/v5.0.25/bin Define environment variables – JAVA_HOME C:\Program Files\Java\jdk1.5.0 – CATALINA_HOME C:\jakarta-tomcat

 2005 Pearson Education, Inc. All rights reserved. 24 Error-Prevention Tip 26.1 On some platforms you may need to restart your computer for the new environment variables to take effect

 2005 Pearson Education, Inc. All rights reserved Setting Up the Apache Tomcat Server (Cont.) Start the Tomcat server – startup Launch the Tomcat server – Shutdown the Tomcat server – shutdown

 2005 Pearson Education, Inc. All rights reserved. 26 Fig | Tomcat documentation home page. Copyright The Apache Software Foundation ( ). All rights reserved.

 2005 Pearson Education, Inc. All rights reserved. 27 Error-Prevention Tip 26.2 If the host name localhost does not work on your computer, substitute the IP address instead.

 2005 Pearson Education, Inc. All rights reserved Handling HTTP get Requests get request – Retrieve the content of a URL Example: WelcomeServlet – a servlet handles HTTP get requests

 2005 Pearson Education, Inc. All rights reserved. 29 Outline WelcomeServlet.jav a (1 of 2) Lines 3-6 Line 10 Lines Line 17 Line 18 Line 23 Import the classes and interfaces in the javax.servlet and javax.servlet.http packages Extends HttpServlet to handle HTTP get requests and HTTP post requests Override method doGet to provide custom get request processing Uses the response object’s setContentType method to specify the content type of the data to be sent as the response to the client Uses the response object’s getWriter method to obtain a reference to the PrintWriter object that enables the servlet to send content to the client Create the XHTML document by writing strings with the out object’s println method

 2005 Pearson Education, Inc. All rights reserved. 30 Outline WelcomeServlet.java (2 of 2) Line 43 Closes the output stream, flushes the output buffer and sends the information to the client

 2005 Pearson Education, Inc. All rights reserved. 31 Outline WelcomeServlet.htm l (1 of 2) Line 13 Line 15 The form ’s action attribute ( /jhtp6/welcome1 ) specifies the URL path that invokes the servlet The form ’s method attribute indicates that the browser sends a get request to the server, which results a call to the servlet’s doGet method Create a button, when clicked, the form’s action is performed

 2005 Pearson Education, Inc. All rights reserved. 32 Outline WelcomeServlet.htm l (2 of 2) Program output

 2005 Pearson Education, Inc. All rights reserved. 33 Software Engineering Observation 26.3 The Tomcat documentation specifies how to integrate Tomcat with popular Web server applications such as the Apache HTTP Server and Microsoft’s IIS.

 2005 Pearson Education, Inc. All rights reserved. 34 Common Programming Error 26.1 Using “servlet” or “servlets” as a context root may prevent a servlet from working correctly on some servers.

 2005 Pearson Education, Inc. All rights reserved Deploying a Web Application Web applications – JSPs, servlets and their supporting files Deploying a Web application – Directory structure Context root – Web application archive file (WAR file) – Deployment descriptor web.xml

 2005 Pearson Education, Inc. All rights reserved. 36 Fig | Web application standard directories.

 2005 Pearson Education, Inc. All rights reserved. 37 Outline Web.xml (1 of 2) Lines 1-37 Lines 8-11 Lines Lines Line 20 Lines Lines Element web-app defines the configuration of each servlet in the Web application and the servlet mapping for each servlet. Element display-name specifies a name that can be displayed to the administrator of the server on which the Web application is installed. Element description specifies a description of the Web application that might be displayed to the administrator of the server. Element servlet describes a servlet.Element servlet-name is the name for the servlet. Element description specifies a description for this particular servlet. Element servlet-class specifies compiled servlet’s fully qualified class name.

 2005 Pearson Education, Inc. All rights reserved. 38 Outline Web.xml (2 of 2) Lines Line 34 Element servlet-mapping specifies servlet-name and url-pattern elements. Element url-pattern helps the server determine which requests are sent to the servlet

 2005 Pearson Education, Inc. All rights reserved Deploying a Web Application (Cont.) Invoke WelcomeServlet example – /jhtp6/welcome1 /jhtp6 specifies the context root /welcome1 specifies the URL pattern URL pattern formats – Exact match /jhtp5/welcome1 – Path mappings /jhtp5/example/* – Extension mappings *.jsp – Default servlet /

 2005 Pearson Education, Inc. All rights reserved. 40 Fig | Web application directory and file structure for WelcomeServlet.

 2005 Pearson Education, Inc. All rights reserved. 41 Common Programming Error 26.2 Not placing a servlet or other class files in the appropriate directory structure prevents the server from locating those classes properly. This results in an error response to the client Web browser.

 2005 Pearson Education, Inc. All rights reserved. 42 Error-Prevention Tip 26.3 You can test a servlet that handles HTTP get requests by typing the URL that invokes the servlet directly into your browser’s Address or Location field because get is the default HTTP method when browsing.

 2005 Pearson Education, Inc. All rights reserved Handling HTTP get Requests Containing Data Servlet WelcomeServlet2 – Responds to a get request that contains data

 2005 Pearson Education, Inc. All rights reserved. 44 Outline WelcomeServlet2.ja va (1 of 2) Line 17 The request object’s getParameter method receives the parameter name and returns the corresponding String value

 2005 Pearson Education, Inc. All rights reserved. 45 Outline WelcomeServlet2.ja va (2 of 2) Line 41 Uses the result of line 17 as part of the response to the client

 2005 Pearson Education, Inc. All rights reserved. 46 Outline WelcomeServlet2.ht ml (1 of 2) Line 16 Get the first name from the user.

 2005 Pearson Education, Inc. All rights reserved. 47 Outline WelcomeServlet2.ht ml (2 of 2) Program output form data specified in URL’s query string as part of a get request

 2005 Pearson Education, Inc. All rights reserved. 48 Fig | Deployment descriptor information for servlet WelcomeServlet2.

 2005 Pearson Education, Inc. All rights reserved. 49 Error-Prevention Tip 26.4 If an error occurs during the servlet invocation, the log files in the logs directory of the Tomcat installation can help you determine the error and debug the problem.

 2005 Pearson Education, Inc. All rights reserved. 50 Software Engineering Observation 26.4 A get request is limited to standard characters, which means that you cannot submit any special characters via a get request. The length of the URL in a get request is limited. For example, the maximum URL length in Internet Explorer is 2,083 characters. Some Web servers might restrict this even more.

 2005 Pearson Education, Inc. All rights reserved. 51 Good Programming Practice 26.1 A get request should not be used for sending sensitive data (e.g., a password) because the form data is placed in a query string that is appended to the request URL as plain text and can be intercepted.

 2005 Pearson Education, Inc. All rights reserved Handling HTTP post Requests HTTP post request – Post data from an HTML form to a server-side form handler – Browsers cache Web pages Servlet WelcomeServlet3 – Responds to a post request that contains data

 2005 Pearson Education, Inc. All rights reserved. 53 Outline WelcomeServlet3.ja va (1 of 2) Lines Line 17 Declare a doPost method to responds to post requests The request object’s getParameter method receives the parameter name and returns the corresponding String value

 2005 Pearson Education, Inc. All rights reserved. 54 Outline WelcomeServlet3.ja va (2 of 2)

 2005 Pearson Education, Inc. All rights reserved. 55 Outline WelcomeServlet3.ht ml (1 of 2) Lines Provide a form in which the user can input a name in the text input element firstname, then click the Submit button to invoke WelcomeServlet3

 2005 Pearson Education, Inc. All rights reserved. 56 Outline WelcomeServlet3.ht ml (2 of 2) Program output

 2005 Pearson Education, Inc. All rights reserved. 57 Fig | Deployment descriptor information for servlet WelcomeServlet3.

 2005 Pearson Education, Inc. All rights reserved Redirecting Requests to Other Resources Servlet RedirectServlet – Redirects the request to a different resource

 2005 Pearson Education, Inc. All rights reserved. 59 Outline RedirectServlet.ja va (1 of 2) Line 17 Lines 21 and 23 Line 22 Line 24 Obtains the page parameter from the request. Determine if the value is either “deitel” or “welcome1” Redirects the request to Redirects the request to the servlet WelcomeServlet.

 2005 Pearson Education, Inc. All rights reserved. 60 Outline RedirectServlet.ja va (2 of 2)

 2005 Pearson Education, Inc. All rights reserved. 61 Software Engineering Observation 26.5 Using relative paths to reference resources in the same context root makes your Web application more flexible. For example, you can change the context root without making changes to the static and dynamic resources in the application.

 2005 Pearson Education, Inc. All rights reserved. 62 Outline RedirectServlet.ht ml (1 of 2) Lines and Provide links that allow the user to invoke the servlet RedirectServlet

 2005 Pearson Education, Inc. All rights reserved. 63 Outline RedirectServlet.ht ml (2 of 2) Program output

 2005 Pearson Education, Inc. All rights reserved. 64 Fig | Deployment descriptor information for servlet RedirectServlet.

 2005 Pearson Education, Inc. All rights reserved Multitier Applications: Using JDBC from a Servlet Three-tier distributed applications – User interface – Business logic – Database Web servers often represent the middle tier Three-tier distributed application example – SurveyServlet – Survey.html – MySQL database

 2005 Pearson Education, Inc. All rights reserved. 66 Outline SurveyServlet.java (1 of 6) Lines 7-11 Line 21 Line 22 Import interfaces and classes for database manipulation Declare a Connection to manage the database connection Declare a Statement for updating the vote count, totaling all the votes and obtaining the complete survey result

 2005 Pearson Education, Inc. All rights reserved. 67 Outline SurveyServlet.java (2 of 6) Line 30 Lines Line 37 Loads the database driver, which is specified in the initialization parameter “databaseDriver” Attempt to open a connection to the animalsurvey database, the database name, username and password are specified in the initialization parameters Create Statement to query database.

 2005 Pearson Education, Inc. All rights reserved. 68 Outline SurveyServlet.java (3 of 6) Lines Obtain the survey response

 2005 Pearson Education, Inc. All rights reserved. 69 Outline SurveyServlet.java (4 of 6) Lines Line 81 Line 84 Line 85 Lines Line 92 Create sql to update total for current survey response Execute sql statement to update total for current survey response Create query to get total of all survey responses Execute query to get total of all survey responses Create query to get survey results Execute query to get survey results

 2005 Pearson Education, Inc. All rights reserved. 70 Outline SurveyServlet.java (5 of 6) Lines Line 105 Line 107 Loop through all records in resultsRS Obtain the value of the first column from the current record Obtain the value of the second column from the current record

 2005 Pearson Education, Inc. All rights reserved. 71 Outline SurveyServlet.java (6 of 6) Lines Close Statement and database connection

 2005 Pearson Education, Inc. All rights reserved. 72 Outline Survey.html (1 of 2) Provide a form in which the user can select an animal from a list of radio button, then click the Submit button to invoke animalsurvey

 2005 Pearson Education, Inc. All rights reserved. 73 Outline Survey.html (2 of 2) Program output

 2005 Pearson Education, Inc. All rights reserved. 74 Fig | Deployment descriptor information for servlet SurveyServlet.

 2005 Pearson Education, Inc. All rights reserved Welcome Files Welcome files – Ordered list of files HTML, JSP documents – Loaded when the request URL is not mapped to a servlet – Defined using the welcome-file-list element Contain one or more welcome-file elements – Specify the partial URL of a welcome file Without a leading or trailing / E.g., specify index.html and index.htm as welcome files index.html index.htm

 2005 Pearson Education, Inc. All rights reserved. 76 Outline index.html (1 of 2) Lines Provide links to test all the examples demonstrated in this chapter

 2005 Pearson Education, Inc. All rights reserved. 77 Outline index.html (2 of 2) Program output