NonStop Servlets for JavaServer Pages (NSJSP) 5.0 System Administrator's Guide

Overview and Architecture
NonStop Servlets for JavaServer Pages (NSJSP) System Administrator’s Guide525644-003
1-7
JavaServer Pages (JSP) Architecture
JavaServer Pages (JSP) Architecture
This subsection discusses
The reasons for using distributed servlets
How to include one servlet within another
How to forward responses between servlets
Simple examples of JSP code are annotated.
A general introduction to JSP is given in JavaServer Pages (JSP) on page 1-4. This
section introduces implementation, models, and syntax basics. For more information,
see the Sun Microsystems Java website at http://java.sun.com/products/jsp.
Typically, JSP pages are subject to a translation phase and a request-processing
phase. The translation phase is carried out once (unless the page changes) when the
JSP page is requested for the first time or when it is precompiled. The result is a JSP
page implementation class file that implements the servlet interface.
The JSP page implementation class file extends HttpJspBase, which in turn
implements the servlet interface. The service method of this class, _jspService(),
essentially inlines the contents of the JSP page. Although the _jspService cannot
be overridden, you can handle initialize and destroy events by providing
implementations for the jspInit() and jspDestroy() methods within your own
pages. When the class file is loaded within the web container, the _jspService()
method replies to a client request. By default, the _jspService() method is
dispatched on a separate thread by the web container when processing concurrent
client requests.
Model-View-Controller Designs
There are two design philosophies for JSP usage. The approaches differ in terms of
where most of the processing takes place. In the first approach, shown in Figure 1-3, A
Basic NSJSP Model, on page 1-8, the incoming request from a web browser is sent
directly to the JSP page that processes the request and replies to the client. Content is
separated from presentation because data access is performed using Java Beans.
This approach works well for simple applications, but requires that all request
processing occurs in the JSP page, making each page individually responsible for
managing the application state, verifying authentication, and maintaining security.