Home arrow Java & J2EE arrow Page 4 - Overview of Java Web Technologies, Part 1

Reviewing Deployment Descriptors - Java

Today, Budi walks us through a refresher and brief overview of server JSP programming. Today's portion covers Servlet technologies, including servlets and Tomcat. This excerpt comes from chapter one of JavaServer Faces Programming, by Budi Kurniawan (McGraw-Hill/Osborne, ISBN 0-07-222983-7, 2004).

TABLE OF CONTENTS:
  1. Overview of Java Web Technologies, Part 1
  2. Methods
  3. Creating a Servlet Directory Structure
  4. Reviewing Deployment Descriptors
  5. Servlet Mapping
  6. Defining Context Parameters
  7. Retrieving Context Parameters
  8. Listening to Application Events
  9. Packaging and Deploying a Web Application
By: McGraw-Hill/Osborne
Rating: starstarstarstarstar / 25
March 01, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement


A deployment descriptor is an XML file, so you can edit it using a text editor. The deployment descriptor for an application compliant with the Servlet 2.3 specification starts with the following:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

These headers indicate that the document type definition (DTD) for this deployment descriptor can be downloaded from http://java.sun.com/dtd/web-app_2_3.dtd. If you open the DTD file, you can see that the root element of a deployment descriptor is
web-app. The web-app element can have up to 23 kinds of subelements, as shown here:

<!ELEMENT web-app (icon?, display-name?, description?, distributable?, context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?, error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*,login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref*)>

All of these subelements are optional, so you are not required to include any of them. The subelements preceding a question mark (?) can appear only once. Those followed by an asterisk (*) can appear many times. Additionally, some of these subelements can have subelements.

Note that in Servlet 2.4, a deployment descriptor is validated against a schema, not a DTD file. However, the elements under web-app are pretty much the same.

Buy this book now!Remember: This is part one of the first chapter of JavaServer Faces Programming, by Budi Kurniawan (McGraw-Hill/Osborne, ISBN 0-07-222983). Stay tuned for part 2 of "Overviews of Java Web Technologies," where we learn about JSP, JavaBeans, and Model 2. 
Buy this book!



 
 
>>> More Java & J2EE Articles          >>> More By McGraw-Hill/Osborne
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

JAVA & J2EE ARTICLES

- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: