Project KaCoMa

KaCoMa Version 1.3 is designed to be a tutorial for beginners of custom taglibraries and/or Unit testing of corresponding software.

The session materials for KaCoMa version 1.3 can be viewed at tutorial.

You can download the tutorial and the KaCoMa application that it contains at This page is also located at

KaCoMa version 1.3 enchancements

Taglib have been improved. exists and equals tags have been replaced by if tag. errtxt tag has been added to be used on the jsp error page. KaCoMaException class has been modified to contain also class and method name where exception occurred.

KaCoMa version 1.3 contains a package fi.iki.kaila.miniproject that is not really a part of kacoma. Miniproject is an implementation of kacoma where pages are created from data in a relational database (MySQL). It is not ready but is included to show interested readers how the author has thought kacoma can be used.

Parts of miniproject is ready and although the software might be released as open source the database will be proprietary for the Genealogical Society of Finland.

Miniproject is designed to eventually replace the "Parishes of Finland " application at

The rest of the text on this page should be considered as possible future enchancements.

KaCoMa version 1.1 does not do what this document describes that it should or might do. KaCoMa version 1.1 is built upon these ideas but is in a prototype stage. The author Kaarle Kaila has used this for two different sessions on techniques used in it i.e. Unit testing and Custom taglibraries. Version 1 and 1.1 are posted in sourceforge to give the author some experience in managing a sourceforge project but also to make it easy for others to use it mainly for learning purposes of these techniques.

1. Abstract

KaCoMa (abbreviation for Kaarle's ContentManagement until further notice) is a ContentManagement system for web-sites. The content of the data is stored in a relational database such as MySQL on the application server. The pages of the web-sites can be displayed using Tomcat servlet engine from with e.g. jsp-pages. KaCoMa is written in the Java language and can be run on different platforms such as Windows or Linux. The database structure is defined according to the database template. The idea is, that each (main) web-page type will take it's content from two separate database tables. One table contains common items for that table and the other table contains language dependent information such as texts for the page. Possibly a third table type is needed for repeating items for the pages such as lists of items, persons or phone numbers. This list may have language variants. The application is divided in two separate parts. Displaying pages from the database and managing the data in the database. A utility to manage the database between local database and server database can be used. The local database could e.g. use MS Access engine and server database the MySQL engine.

2. Server application

Table structure for database

The database has a structure with fixed table and column names and types. Not variable as described in section 2.1. To be able to display variable datatypes in fixed table types the variable part is imbedded in the data. Most data contents is contained in BLOB fields of the database in xml-structures. Using BLOB instead of large texts makes use of chracatreset UTF-8 possible. The first study of this resulted in following tables:

Table Content

Table Langu

Table Attachment

Contains items such as pdf- or doc- documents, zip and exe-files etc

Table Pictures

Table Topic

XML style

Check CVS directory xml for the XML testfiles. The file "xml/test/KaCoMaTest.xml" is the testdatafile and the file "xml/static/test.xml" is the corresponding static file. KaCoMa is used at this moment for exercises and educational use of Java tools like jdom (at and Unit testing with JUnit ( and JUnitEE (at

CVS contains a simple test application that runs on weblogic 6.1 or tomcat 4.0. You must edit the filepaths in the properties files to suit your application.

This here like much else are plans at a very early stage and much will probably still change.

3. Managing the content

Managing the content means managing the database. It is possible to keep two (or more) databases where content is managed and to push the content from these databases to the production database when content is ready and has been verified locally. The local database can use a different database engine than the server database. Here we assume that server database is a MySQL database and the local database format is that of MS Access 2000. The action field in the local database table directs the action of the push-operation.

3.1 Managing with the browser

The managing of the content in the local database can be done using various tools. KaCoMa will contain a simple browser based tool for managing the content. This tool assumes that naming of the jsp-pages follows the practice mentioned in the previous section. Using the book tables in Example 1 the user can list all names (books) in the book table and select one for update. The page to update is displayed as a html-form where the user can make the modifications. In case several language versions exist the user will be editing the language version he has selected to edit. After editing one language version the user may select another language and make changes to that. The edit-tool contains a command (button) to view the page. This will open the page in a separate browser window.

3.2 Managing with MS Access

KaCoMa will not contain a ready-made application for editing the database in MS Access. As there are user's who are skilled Access users they may however prefer to edit the local database in MS Access. Possibly such tools can be incorporated in KaCoMa at a later stage. Simple modifications can easily be made in MS Access by some simple queries. Especially, where similar modifications are needed for several pages this can be very useful. The new table structure described in section 2.2 makes using Access directly difficult as the author is not very familiar with MS XML-structures.

3.3 Managing with Excel

A simple tool will perhaps be available for users of MS Excel 2000 where pages can be edited on an Excel worksheet. Benefits in Excel are that it is possible to have the different language versions side by side. Use of Excel requires that the local database format is MS Access. The new table structure described in section 2.2 may not be available for an Excel application as the XML-skills of the author are mainly Java-based. This would result in the Excel interface not being available at least very soon.

4. Formatting of the content

Formatting of the content can be necessary. For this there will not be any automatic tools at least in the first version of KaCoMa. The content manager can use html tags in editing the text to emphasize his text. Use of html within the portal must be planned in coordination with the portal designer. If e.g. portal is designed using style sheets then obviously those styles should be used also in formatting the content. There will be a set of recommended html-tags and elements to be used in formatting the content for the portal. Following should be seen as the set, that portal designer should at least allow for in the content. These tags should include at least the strong, em, sub, sup, h1 ,h2, h3, ol, ul, li, and possibly table, tr and td tags.

4.1 Hyperlinks

The content needs to include hyperlinks to other pages or other sites. Some links have a separate field in the database and are handled in the jsp-page as designed by the portal designer. Other links however are needed inside the content text for the page. These can be divided in two groups:

  1. Absolute links and mailto links. These are written into the pages directly as html-elements.
    Example: <a href="">KaCoMa software page</a>
  2. Relative links are written as the absolute links. The address of the page to reference is written as
    <a href="book.jsp?name=wonders">Book of wonders</a>. In this example wonders is the identifying name of the book. On generated pages such as director pages to books it is also possible to use the format
    <a href="book.jsp?id=32">Book of wonders</a> where 32 is the numerical primary key of the record Book of Wonders.

5. Pushing/pulling the content from local database

The database contains fields with commands for the push/pull application. The push application reads data from the local database and writes the required data to the server database. The pull command reads data from the server database to the local database. It is possible to push only modified rows or alternatively do a complete push. In this case the previous contents in the database server will be deleted before the push. It will also be possible to select one page (with all languages) from a list of pages and push or pull only that.

6. Databases and servers supported

Databases supported in initial face will be MySQL and MS Access 2000. The application will be written so that database dependency is minimized so other databases could be "easily" used. The database specific settings will be located in a properties file or possibly xml-file. In the initial face the application will be built for the tomcat servlet engine from, but there will not be any tomcat specific solutions so any compatible servlet engine should be OK. The application does not need to use J2EE components like EJB's, but the jsp-pages can use other J2EE components in an environment where these are available. If the browser application is used locally for editing, viewing and managing the database it must be used utilizing the servlet engine (tomcat) also in the local environment. Certain tasks can be locally performed also without the servlet engine such as managing the database using Access or Excel.

7. Sort-order

A method to produce sortable fields will be included. In certain regions such as the Nordic countries sorting of names is not performed using plain binary order. Characters , and are located last in the alphabet and V and W have the same sort value. Some characters also have been defined so that = Y, =, = and = ss. This will be defined using an interface so that other sorting algorithms can be added if needed. The name of the class for language sorting is defined in the application properties file. The name of the sortable field in the language dependent database table begins with "sort".

8. Implementation plans

KaCoMo application is designed to be used for managing the contents of the currently static pages of the Genelogical Society of Finland. There are several pages at that are currently updated manually and in need for separation of content from the pages. Pages such as the genealogists bookstore will be kept in mind when KaCoMo is designed.

Design of KaCoMo is made for a general application in mind so, that it will not be restricted to any single portal but can be used for other pages with similar simple needs.

For comments contact Kaarle Kaila at
Project page for KaCoMa is at