All JSP containers must support HTTP as a protocol for requests and responses, but a
container may also support additional request/response protocols. The default request and
response objects are of type
HttpServletRequest
and
HttpServletResponse
,
respectively.
A JSP page may also indicate how some events are to be handled. In JSP 1.1 only
init
and
destroy
events can be described: the first time a request is delivered to a JSP page a
jspInit()
method, if present, will be called to prepare the page. Similarly, a JSP container can reclaim
the resources used by a JSP page at any time that a request is not being serviced by the JSP
page by invoking first its
jspDestroy()
method; this is the same life cycle as that of
Servlets.
A JSP page is represented at request time by a
JSP page implementation class
that
implements the
javax.servlet.Servlet
interface. JSP pages are often implemented
using a JSP page
translation phase
that is done only once, followed by some
request
processing phase
that is done once per request. The translation phase creates the JSP page
implementation class. If the JSP page is delivered to the JSP container in source form, the
translation of a JSP source page can occur at any time between initial deployment of the JSP
page into the runtime environment of a JSP container and the receipt and processing of a
client request for the target JSP page.
A JSP page contains some
declarations
, some
fixed template
data, some (perhaps nested)
action instances,
and some
scripting elements
. When a request is delivered to a JSP page, all
these pieces are used to create a response object that is then returned to the client. Usually,
the most important part of this response object is the result stream.
1.4.2
Compiling JSP Pages
JSP pages may be
compiled
into its JSP page implementation class plus some deployment
information. This enables the use of JSP page authoring tools and JSP tag libraries to author
a Servlet. This has several benefits:
Removal of the start up lag that occurs when a JSP page delivered as source receives the
first request.
Reduction of the footprint needed to run a JSP container, as the java compiler is not
needed.
If a JSP page implementation class depends on some support classes in addition to the JSP
1.1 and Servlet 2.2 classes, the support classes will have to be included in the packaged WAR
so it will be portable across all JSP containers.
Appendix C contains two examples of packaging of JSP pages. One shows a JSP page that is
delivered in source form (probably the most common case) within a WAR. The other shows
how a JSP page is translated into a JSP page implementation class plus deployment
information indicating the classes needed and the mapping between the original URL that
was directed to the JSP page and the location of the Servlet.
23
JavaServer Pages 1.1 Specification November 30, 1999
JSP Web Hosting JavaServer Pages Specifications JSP Hosting
|
|
|
|
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved. |