Java Server Pages offer powerful server-side access to a multitude of databases and legacy systems. Available for several years now, they've only recently come into widespread use, now that tools to develop and deploy them have come of age. But still, getting a web server to correctly serve JSPs can be frustrating.
This workshop walks you through the process of installing the necessary software to provide an Apache Web server with the ability to serve up JSPs. You need a servlet engine as well as a set of classes to process JSPs. We'll use JServ 1.1.2 as our servlet engine, coupled with GNUJSP 1.0 to handle JSPs. Note that GNUJSP 1.0 supports JSP specification 1.0. For support of JSP 1.1, you'll want to use Jasper, which is a (part of Jakarta Tomcat).
How JSPs Are Served
When a Web server receives a request for a page, it looks through it's configuration settings to see if the requested page's MIME type or file extension needs to be handled by one of its containers. Normally, server administrators handle pages with a .jsp extension via a servlet container. The Web server hands a .jsp request off to the designated handler, which in turn will run the JSP handler (usually a class that will compile and execute the resulting code). This initial handler will then wait for the resulting HTML to be returned. Note, the servlet container can be running on the same host as the requested content or on a remote host. All that is required is the correct configuration in the Web server's configuration file to tell Apache where to send requests for JSPs.
Versioning
Before you can serve JSPs, you've got to find out what you can support and whether you'll need to upgrade or install the necessary components. We'll make the assumption that the only piece of the puzzle you've already installed is the Web server.
If you are building DSO (dynamic shared object) modules, you need to make sure that Perl 5.004 or later is installed because of the dependency on the Apache apxs (APache eXtenSion) module, which provides the ability to build DSO based modules outside of the Apache source tree. http://www.perl.com
The complete Apache JServ installation requires less than 2 MB of hard disk space. The compiled, uncompressed jar archive is approximately 100 KB. JServ works only with Apache 1.3.x and uses only standard Java classes (java.*).
The servlet engine (or container as it is often referred to in the documentation) can be installed as a dynamic module or compiled directly within the Apache binary. While we like dynamic module loading as a means of extensibility, we often compile modules into Apache, which is of course a more tedious process. We set up JSP support using both models, and there is little difference between them excepting the process of rebuilding Apache to include JServ support in a static build environment. Compiling modules reduces the ability to upgrade modules easily, but executes 5 percent faster than a DSO build.
So grab the tar files you need, and let's get moving.
If you have any comments on or questions about this article, please message Lori MacVittie at lori@nandgate.com.
REPORTS
Analyize In-Line NAC strategies and products.
ANALYTICS Plan and design your enterprise blade server deployments
2009 IT Salary Survey: Meager Raises, Solid Prospects
Though raises are notably smaller than a year ago, and job security’s shrinking, IT careers are looking safer than many others in this economic downturn. Get all the findings in InformationWeek's 2009 IT Salary Survey. Available FREE for a limited time.