NonStop Servlets for JavaServer Pages (5.0) System Administrator's Guide
Configuring NSJSP
NonStop Servlets for JavaServer Pages (NSJSP) System Administrator’s Guide—525644-002
3-18
Compile a Servlet
1. Create the appropriate directory structure under $NSJSP_HOME/webapps. If you
prefer to locate elsewhere, use the docbase attribute of the context path. Populate
with the required servlets and JSP files.
2. Create a local version of the web.xml file for deployment descriptors. Note that if
you write the deployment descriptors in the main default web.xml file, creating a
WAR file is difficult later on (only the local version of web.xml becomes part of the
WAR file).
3. Create the <context>.xml in the $NSJSP_HOME/conf/NSJSP/<host-name>/
directory.
4. Add a filemap to filemaps.config corresponding to the application name.
5. Restart the NSJSP process.
Compile a Servlet
To compile a servlet in the NSJSP container, include the following JAR file in your OSS
environment variable CLASSPATH:
$NSJSP_HOME/common/lib/servlet-api.jar
If you are using the source code location
. ./webapps/yourapplicationname/WEB-INF/src
Enter the following command to compile the servlet:
javac -d ../WEB-INF/classes/ *.java
where
asterisk (*) is the servlet name or names of Java classes you wish to compile and
use in your servlet applications.
This command compiles the Java files and creates the class files under /WEB-
INF/classes.
Deploy a Servlet
Enter a servlet name and a class name in the deployment descriptor. You can use the
same name for both the servlet and class, or you can use the servlet name as an alias
in a URL rather than revealing the whole servlet class name. Thus, in Example 3-11,
the URL could refer to start rather than startCartRequest.
The deployment descriptor web.xml is located in the WEB-INF/ subdirectory within
your application directory.
A fragment of that file is shown in Example 3-11: