NonStop Servlets for JSP System Administrator's Guide

Overview and Architecture
NonStop Servlets for JavaServer Pages (NSJSP) System Administrator’s Guide—525644-001
1-10
An Example of JSP Code
Scriptlets. You can write Java code anywhere in a JSP page, in the form <% code %>.
By using the import attribute of the page directive you have access to all Java APIs
from within your scriptlet code.
An Example of JSP Code
Example 1-1 is an example use of templating, a common technique used in web page
development, which uses the services of more than one servlet. We show the template
coded as JSP using the include directive to reference some HTML in another file.
NonStop Servlets for JavaServer Pages
(NSJSP) Architecture
This subsection contains background information about the NonStop Servlets for
JavaServer Pages (NSJSP) architecture. It illustrates and discusses the relationships
between HTML clients, iTP Secure WebServer processes, and the web container
environment. It also describes the lifecycle of a servlet and the benefits of running
servlets in NonStop TS/MP server classes.
The NSJSP implementation is a multi-threaded out-of-process servlet container: a
Java web container (with web applications) that runs in a Java Virtual Machine (JVM)
outside of the iTP Secure WebServer HTTPD process. This architecture is shown in
Figure 1-5, iTP Secure WebServer Servlet Architecture.
In essence, NSJSP provides the same JVM functionality as any other J2EE
implementation, but is unique in its ability to scale across multiple CPUs to provide a
NonStop computing environment.
Each web container can contain a number of applications, each with their own servlets,
JSP, and other resources. These containers are accessible by any HTTPD process
running on any CPU. The containers and the HTTPD processes are part of the
NonStop TS/MP 2.0 environment.
Example 1-1. JSP Code
<%-- Filename: "TemplateDemo.jsp" --%>
<HTML>
<BODY>
<CENTER> Welcome To My WebSite</CENTER>
<BR>
<P> The time is <% new java.util.Date().toString() %> </P>
<%@ include file = "Body.html" %>
</BODY>
</HTML>
The HTML file called Body is:
<BR>
<H1>
This is text that will be included in the body of the HTML in the JSP file
</H1>
<BR>