NonStop Servlets for JSP System Administrator's Guide
Programming and Management Features
NonStop Servlets for JavaServer Pages (NSJSP) System Administrator’s Guide—525644-001
4-4
Servlet and NSJSP Examples and References
•
Transaction protection in NonStop Server for Java is based on, but not identical to,
the current interface defined by Java Transaction Services.
For complete information about compliance characteristics of NonStop Server for Java
and about ensuring portability of Java programs to and from NonStop Server for Java,
see the NonStop Server for Java (NSJ) Programmer’s Guide.
Servlet and NSJSP Examples and References
Once you install and start the servlet container, you can access the NSJSP Sample
page from a web browser at URL:
http://hostname:portnumber/servlet_jsp/
From here you can find a listing of the Servlet API 2.3 and JSP API 1.2 (servlets and
JSP) interfaces, classes, and methods. The list of methods corresponds to the content
of the javax.servlet and javax.servlet.http packages defined by Sun
Microsystems.
If you are migrating from a previous release of Java Servlets such as 2.0, you should
check the API spec to ensure that any methods or interfaces you have used in the past
have not been deprecated. See the iTP Secure WebServer System Administrator’s
Guide for information on migration from T0094 to T1222. Then, refer to Section 7,
Migration to NSJSP 2.0 for information on migrating from NSJSP 1.0 to NSJSP 2.0.
Using the Servlet API
The servlet API includes interfaces, classes, and methods that structure the interaction
between a servlet and a web client. The following classes facilitate servlet usage.
The HttpServlet Class
This class extends the class GenericServlet by overriding the
service(ServletRequest,ServletResponse) method, which receives, processes,
and responds to a request from a web client. The HttpServlet class inherits the
init(ServletConfig) and destroy() methods from the GenericServlet
class.
A servlet that you write for the iTP WebServer environment must extend either the
GenericServlet class or the HttpServlet class; the HttpServlet class is
preferable for the web environment because it includes many features supporting
HTTP protocol. Your servlet should override the init(ServletConfig) method to
perform any necessary initialization, the
service(ServletRequest,ServletResponse) or
service(HttpServletRequest,HttpServletResponse) method to process
requests as the application requires, and the destroy() method to deallocate
resources gracefully.
Your servlet should also use the doGet() and doPost() methods where applicable.