3. JavaServer Page Architecure

JavaServer Page Software

There is a large selection of software available for the hosting of JavaServer pages including the following.

For a full list see the article Industry Momentum at the Sun web site.

Tomcat is the reference implementation of a Application Server produced by the Apache group as part of the Jakarta project. In theory, a JSP application that works on Tomcat should also work with any other Application Server that has compliant with the JSP specification.

What hasn't been mentioned so far is that JSP comes in different versions. JSP is an open source technology where Sun writes a specification for what a Application Server should be and then various vendors write the commercial Application Server software adhering to this specification. After JSP 1.0 Sun handed the responsibility to the Apache Software Foundation who maintain the specification under the Jakarta project.

Installation and Configuration

rather than provide detailed instructions for each Application Server, version and platform, the instructions below discuss the installation and configuration steps that are common in all scenarios. Each Application Server comes with its own setup instructions which should be consulted for further details.

the majority of Application Servers require that the JDK be already installed and configured on the server. JDKs come in different versions and you should use the version appropriate for your Application Server. The Java Development Kit can be downloaded as part of the Java 2 SDK which can be obtained from the Sun's web site here Sun.

To install a JDK on a Windows Server

  1. Executing the installation program
  2. Choose the default installation
  3. Accept defaults for installing the JRE

Further information on installaing and on installing on UNIX based machines see the Java 2 SDK web page. It is also worth obtaining documentation of the Java API which can be downloaded from Sun's web site here,
Java2 SDK Documentation.

An important aspect of running java software is something known as the classpath. Crudely this is the equivalent of the windows registry and is responsible for instructing the Java Virtual Machine where to find the various components required for Java applications. (To get an idea of it's importance just remember what happened the last time your registry got corrupted!). Unlike the Windows registry the classpath can be configured differently for each Java application and a wrongly configured classpath is often responsible for applications failing to run. It is recommended that the following articles should be read to further understand the classpath - Win32, Solaris

Once the Java 2 SDK has been installed we can now install the Application Server.

Each application server follows more or less the same installation and configuration. Depending on the software some of these steps are completed during the install others you have to do manually:

  1. Execute installation program
  2. Specify the location of the JDK or Java 2 SDK
  3. Specify a port for the Application Server to listen on
  4. Specify the directory for the web application - where you will place all your JavaServer Pages.
  5. Test installation

Configuring a Web Server to use an Application Server

Simply this involves telling the web server that when it comes across a request for a file ending in JSP it should pass on the request to the JSP container.

The way to connect a web server to an application server varies for each combination and it is not practical to describe each scenario. In general it often requires the use of a connector, a separate piece of software, that forwards request and responses between the web server and application server. Details of how to configure and setup these connectors can be found in the documentation of your web server or application server.

Workshop

The first workshop is quite straightforward - install and configure Tomcat

Back Next