Chapter 5 Customizing JavaServer Pages
You can customize the Learning Management System application by customizing its JavaServer
Pages. This chapter contains the following information:
Overview
LMS JSP tag libraries
The Anatomy of a JSP
Making global changes
Applying customization sets
Changing application style
Updating page text
Replacing graphics
Changing individual JSPs
Changing a JSP’s style
Altering a JSP’s functionality

Overview

The architecture of the Learning Management System application is based on Struts 1.1, beta 2,
which is part of The Jakarta Project, sponsored by Apache Software Foundation. The Struts
architecture helps to separate logic from presentation in a JavaServer Page application using the
MVC (Model-View-Controller) design pattern. In this design pattern, the Model component
represents the business logic of the application, the View represents the display mechanism, and
the Controller passes control from the request to the model and from the model to the view.
In the Learning Management System application, a user request triggers the initialization of a
controller servlet that parses a configuration file. The configuration file, named Struts-config.xml,
maps the request to the appropriate action class to handle it. Action classes on the Learning
Management System server have a .do extension and those on the Delivery server have a .ds
extension. Once the handler performs the action, it calls a form class to structure the result. It also
determines which JavaServer Page the response should be forwarded to for display in the
browser. The Struts-config.xml file contains action mappings that map the forwards returned by
the actions to specific JavaServer Pages. The Struts-config.xml file contains both global forwards
and one or more additional forwards for specific actions. You can find documentation defining
the Struts architecture at http://jakarta.apache.org/Struts/.
The view component of the MVC model is handled by JavaServer Pages in the Learning
Management System. The JavaServer Pages reside on each server hosting the application.
JavaServer Pages (JSPs) are pages comprised of standard HTML, JavaScript, Java scriptlets, and
JSP tags. JSP tags are similar to HTML tags; both define display characteristics for elements on a
page. However, JSP tags differ in that they also serve as references to Java code. Each JSP tag
triggers the execution of a piece of Java code written and stored elsewhere in the application. The
attributes of a JSP tag serve as the parameters to pass to the Java class.
A JSP is served to a browser client from the server of the hosting application. It works like this:
when a JSP-based application is deployed, the server pre-compiles the JavaServer Pages into a
servlet, which executes any code triggered by the JSP tags on the page and dynamically generates
the response page content. These pre-compiled JSPs are stored in the server’s file directory. When
Chapter 5: Customizing JavaServer Pages 19