Adding and deleting servlets to a free-form project
You can add or delete servlet source code, annotated source or
compiled class files to or from a free-form project.
Restriction:You
can use the rapid deployment tools for packaging applications at J2EE 1.3
or 1.4 specification-levels. However, the rapid deployment tools do not support
Java EE 5.0 nor J2EE 1.2 specification-level.
Prerequisites
The
servlet class must be an implementation of the following types:
To add servlets to a free-form project, use your file management
system to properly place your servlet artifacts into the free-form project.
The directory name of the free-form project has the same string value you
provided for the -project parameter used in the wrd-config
command.
The following activities occur when you drop a servlet into a free-form
project:
If necessary, the servlet class is generated and mapped to the imported_classes directory
of the Web module project. The rapid deployment tools will then copy the class
files to its appropriate J2EE location which is WebContent/WEB-INF/classes folder
of the Web module project. The console output can look like this example when
adding a servlet Java™ source file (called HelloServlet.java) to
a free-form project (called MyProject):
[06:52:23 PM] [/MyProject/servlet/HelloServlet.java] Added
[06:52:26 PM] [/MyProject/bin/servlet/HelloServlet.class] copied to project [MyProjectWeb]
[06:52:27 PM] Servlet added to web.xml: HelloServlet
[06:52:27 PM] Servlet mapping added. URL is: [MyProjectWeb/HelloServlet]
Tip: If you want to monitor the rapid deployment activity,
run your rapid deployment session with console output. You can complete this
by running the rapid deployment launch tool as follows:
wrd.bat
-monitor
wrd.sh
-monitor
A new servlet entry and servlet mapping entry is created in
the Web deployment descriptor (found in the WebContent\WEB-INF\web.xml file
in the Web module project). The following is an example of the entries in
web.xml:
You can test the servlet running on the server, use the URL displayed
in the console. In this example, the console output provided the following
URL mapping information to the deployed servlet:
[06:52:27 PM] Servlet mapping added. URL is: [MyProjectWeb/HelloServlet]
Type http://<machine_name>:<port>/MyProjectWeb/HelloServlet in
the address bar and press Enter. Where <machine_name>
is the host machine where WebSphere® Application Server runs. By default, WebSphere Application
Server runs on port 9080.
To delete servlets from a free-form project, use your file management
system to properly remove your servlet artifacts from the free-form project.
The directory name of the free-form project has the same string value you
had provided for the -project parameter used in the wrd-config
command.
The following activities occur when you remove a servlet from the
free-form project:
The console output can look like this example when removing
a servlet Java source file (called HelloServlet.java) from
a free-form project (called MyProject):