blob: 8942b51d56197d6c52eedf33aceaf8755207c256 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<?NLS type=""?>
<!-- /*******************************************************************************
* Copyright (c) 2000, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/ -->
<context id="srvw1050">
Specify the <b>Project</b> and <b>Folder</b> where the servlet class will be placed. The servlet class should be stored in the Java source directory that you specified when you created the Dynamic Web Project (for example src).
Specify the <b>Java package</b> that the class will belong to (it is added into a default package if you do not specify one).
Specify the <b>Class name</b> of the servlet (for example HelloServlet).
In the field <b>Superclass</b> specify a superclass for the servlet class. A servlet created by this wizard can have HttpServlet, or any class that has HttpServlet in its hierarchy as its superclass. Click <b>Browse</b> to choose from the available superclasses.
Check <b>Use existing Servlet class</b> and you could get an already existing class and it will be registered automatically in your web.xml.
Note: If you have selected the XDoclet facet when creating the Dynamic Web Project, you can now select <b>Generate a XDoclet annotated class</b>. This will create a XDoclet annotated servlet class. The annotations will generate the metadata in the web.xml deployment descriptor.
<topic label="Creating Servlets" href="../org.eclipse.wst.webtools.doc.user/topics/twsrvwiz.html"/>
<context id="srvw1100">
Note that the Class Name value provided in the first page of the wizard is automatically mapped to the <b>Name</b> field on this page.
Specify the <b>Initialization Parameters</b> of the servlet as name/value pairs, for example passwords.
In the <b>URL Mappings</b> field, specify the URL pattern to be mapped with the servlet.
<topic label="Creating Servlets" href="../org.eclipse.wst.webtools.doc.user/topics/twsrvwiz.html"/>
<context id="srvw1200">
Note that the Sun Microsystems Java Servlet Specification states that a Servlet class must be <b>public</b> and not <b>abstract</b>. Therefore, you cannot change these modifiers. The only one available for change is the <b>final</b> modifier.
If one of the HttpServlet or GenericServlet classes is not specified as a superclass of the Servlet class, the <b>javax.servlet.Servlet</b> is provided as the default interface and defines life cycle methods. You can use the wizard to add additional interfaces to implement.Click <b>Add</b> to open the
<b>Interface Selection</b> dialog. In this dialog, as you type the name of the interface that you are interested in adding in the <b>Choose interfaces</b> field, the list of available interfaces listed in the <b>Matching items</b> list box updates dynamically to display only the interfaces that match the pattern.
When the <b>Inherited abstract methods</b> option is checked you can select which methods, provided by HttpServlet class, to be overridden. The available methods are:
- <b>init, service and destroy</b> which carries of the servlet's life cycle;
- <b>getServletConfig and getServletInfo</b>, which returns respectively servlet's ServletConfig object containing initialization and startup parameters and information about the current servlet;
- the six <b>doXXX</b> that get called when a related HTTP request method is used.
Note: If you did not specify HttpServlet class as superclass in the first page of the wizard, the option <b>Inherited abstract methods</b> is always checked and can not be changed, because each servlet must implement the methods of the javax.servlet.Servlet interface: init, service, destroy, getServletConfig and getServletInfo.
Using the option <b>Constructors from superclass</b> you can choose whether to override the constructor of the class, which you specified as superclass in the first page of the wizard. Note: If you did not specify any class as superclass, you can not check this option.
<topic label="Creating Servlets" href="../org.eclipse.wst.webtools.doc.user/topics/twsrvwiz.html"/>