Content Management
Eye candy brings them in, but content brings them back, especially if that content is kept up-to-date and
topical. Armed with a good tool, we can convert the effort needed to keep a site current from an
everyday struggle into a daily pleasure. This chapter steps through a case study that develops an article
management system for a news site, or any site that posts articles on a regular basis.
We'll build on this example throughout this chapter and the next two. In this chapter, the application is
a simple news posting utility. Then we will use it to provide the articles as subscription content to other
sites. Finally, we will enhance the search capabilities to make the articles easier to find.
We will be building the application using the Struts Framework, introduced in Chapter 2. If your own
applications are built with Struts, our news poster could be plugged in as a JAR library, and the control-
flow mappings copied into your own Struts configuration file. The articles case study is a simple
database application that demonstrates best practices you can use in other Struts projects.
Before we get started, let's discuss why a news poster is a good choice for a content management
case study.
Managing Timely Content
Most of the work in content management today revolves around:
-
Separating content from the presentation layer
-
Making updated content available wherever it is needed
-
Organizing and searching content
The conventional approach for separating content from presentation is to use XML to store the content,
which is then formatted at run time using a stylesheet. See Chapter 12 of Professional JSP 2nd Edition
from Wrox Press (ISBN 1-861004-95-8) for more about using XML with JSP pages.
However, using XML and stylesheets this way is still a developing technology. Initiatives like Apache
Cocoon (http://xml.apache.org/cocoon/) and Apache Slide (http://jakarta.apache.org/slide/) are going to
have a lot to offer us in the near future, but are not quite ready for everyday use in a production site.
For most working web sites, the last two points, keeping content update fresh and making it easy to find,
are the issues that need to be addressed today.
HTML is a capable format for creating static pages, and with JSP, dynamic pages can be created without
much effort. However, a problem many web sites still have is that continually adding new content to the
site requires knowledgeable personnel who can be trusted to add a new page without disrupting the
others. Adding a new page often means updating another index page so that the visitors can find it. So,
the person adding the page has to know how to do that too, and be trusted to do it correctly.
Where this tends to happen most often is with articles that are posted to a site on a regular basis. These
may be news articles, a column, or just "what's new" snippets. Generally, the latest posting replaces the
previous posting, which is relegated to an archive.
A way to streamline posting material like this is to use a news posting utility. This is the most common
approach to content management today. News posters are running many popular sites, like SlashDot
(http://slashdot.org/) and NewsForge (http://www.newsforge.com/). See Chapter 14 for more about
these sites, where we cover another popular approach to content management portals. While there is
no shortage of news posting applications for other platforms like PHP, there is very little available for
Java web applications. So, let's fill that gap with a news posting application of our own.
Articles
First, to give us a place to start, let's set out a simple workflow for our base application, and highlight
some technical requirements the application must meet.
Workflow
A workflow is the flow or progress of work done by a company, industry, department, or person.
Sometimes an entire workflow can be represented within an application. More often, an application
represents only part of a greater workflow. A point-of-sale application may record the sale and order
inventory, but it doesn't put the merchandise into the bag and hand it to the customer.
Our news poster is part of a greater workflow that would include identifying articles to write, writing the
articles, and perhaps approving them for publication. For now, let's look at that portion of the overall
workflow that must be handled by our example application for it to be useful:
-
Contributors log in to the application
-
Contributors complete a web form with the article's title, author, and content as a text
paragraph or HTML
-
Contributors may edit or delete their own articles, and the articles of other contributors
-
Visitors may list current articles by date entered, or search for specific articles by title, author,
or content
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|