Java Web Programming with Eclipse contents
Last modified April 01, 2009 12:54 pm

back next

Wiki Application (continued)

Overview

A wiki is a web application that allows users to create and modify web pages. A wiki provides a simple markup language (method of annotating text) that users can use to provide links to other wiki pages and to accomplish simple formatting. In this chapter, we will construct a new web application that implements a simple wiki. To make the implementation simpler, users will use HTML rather than tradiational wiki markup when editing page contents. The following diagram illustrates the page flow for the wiki application.

page flow diagram for wiki application

Conceptually, a wiki contains every possible page, which means that all requests for pages are considered valid. If the user requests a page that has never had content added to it, then the user sees a blank page. In the database, only pages that have non-empty content are stored. A page with only white space is considered empty, and is thus not stored in the database. If a user wishes to delete a page, he or she sets its contents to empty, and the application will then delete the page from the database.

Note that in wiki systems such as the open source project used by Wikipedia, called MediaWiki, the history of edits to pages are saved so that users can restore previously deleted content or simply view previous versions of a page. In our simple wiki, we will not store previous versions of pages, which could be a great inconvenience in a real usage scenario.

In our wiki system, users see an edit link and a publish link on each page. To change the contents of the page, whether it is an initial entry or a mofification to existing content, the users selects the edit link and transitions to an edit page. In the edit page, the user can modify the contents of the page and then either save or cancel changes. In both cases, the user is brought back to the view page.

The above diagram actually shows two versions of the view page: one with a publish link and one with an unpublish link. In this wiki system, we will be able to create and delete news feed entries in the publisher application that refer to wiki pages. If a given wiki page is not registered with the publisher application, then the publish link is shown. If the user clicks on the publish link, he or she is brought to the publish page, which is a confirmation window. If the user confirms the publish operation, the system returns the view page with the unpublish link to indicate that the page is in the news feed and to give the user the ability to remove the page from the news feed. If the user cancels the publish operation, he or she is brought back to the view page with the publish link.

The unpublish link goes to the unpublish page, which is also a confirmation page.

In this chapter, we will build all the above functionality, however we will implement the publish and unpublish operations as stubs. The term stub is used to describe a function that is declared and callable, but has no effect; it is used as a placeholder for the real implementation to be done at a later time.

In the chapter that follows, we implement the publish and unpublish operations as web services in the publisher application. The wiki application will then invoke these web services to create and delete news feed entries for wiki pages.

back next

Copyright 2007-2009 David Turner and Jinseok Chae. All rights reserved.