Oracle JavaServer Pages Developer's Guide and Reference Release 8.1.7 Part Number A83726-01 |
Library | Service | Contents | Index

## Standard JSP Interfaces and Methods

Two standard interfaces, both in the `javax.servlet.jsp` package, are available to be implemented in code that is generated by a JSP translator:

- `JspPage`

- `HttpJspPage`

`JspPage` is a generic interface that is not intended for use with any particular protocol. It extends the `javax.servlet.Servlet` interface.

`HttpJspPage` is an interface for JSP pages using the HTTP protocol. It extends `JspPage` and is typically implemented directly and automatically by any servlet class generated by a JSP translator.

`JspPage` specifies the following methods used in initializing and terminating instances of the generated class:

- `jspInit()`

- `jspDestroy()`

Any code for these methods must be included in scriptlets in your JSP page, as in the following example:

    <%!
       void jspInit()
       {
          ...your implementation code...
       }
    %>

(JSP syntax is described later in this chapter. See "Scripting Elements".)

`HttpJspPage` adds specification for the following method:

- `_jspService()`

Code for this method is typically generated automatically by the translator and includes code from scriptlets in the JSP page, code resulting from any JSP directives, and any static content of the page. (JSP directives are used to provide information for the page, such as specifying the Java language for scriptlets and providing package imports. See "Directives".)

As with the `Servlet` methods discussed in "The Servlet Interface", the `_jspService()` method takes an `HttpServiceRequest` instance and an `HttpServiceResponse` instance as input.

The `JspPage` and `HttpJspPage` interfaces inherit the following methods from the `Servlet` interface:

- `init()`

- `destroy()`

- `service()`

- `getServletConfig()`

- `getServletInfo()`

Refer back to "The Servlet Interface" for a discussion of the `Servlet` interface and its key methods.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index