Chrysalis Sample Applications

The full Chrysalis distribution includes the following sample application. Each sample has everything it needs, including a build script (build.xml) and all the Chrysalis jars. Because this makes the distribution larger, there is a separate Chrysalis distribution without the sample applications.

The business objects in the Chrysalis sample applications use either object serialization or XML files to store their data. This is to avoid having to install a database to view the sample applications. All of the applications could be modified to store their data in a relational database by updating altering the business object layer (or better yet, using an Object-to-Relational-Mapping tool like JDO or Hibernate).

catalog

The original Chrysalis sample application, this is a small online catalog management system. Most of the examples in the Chrysalis documentation refer to this application.

catalog-i18n

An internationalized version of the catalog application. Only the view layer is internationalized; the business object layer (and the data itself) is not.

quiz

A simple online quiz system. This application demonstrates how Chrysalis controllers can completely control navigation. There is one primary view page: showQuestion.jsp. Updates to the QuizController move the user through the quiz, with methods like gotoPrevious() and gotoNext().

This technique is only recommended when the user is interacting nearly continuously with the application (as is the case with a quiz). For general applications, session timeout might discard the controller and thereby lose the user's position information.

weblog

This application is a fairly faithful replication of the Wafer Project's weblog application. The only major change is that the Chrysalis weblog uses object serialization to save its data. This is not because Chrysalis does not support database operations; it is to simplify deployment of the sample application.

This application is a good demonstration of Chrysalis's custom security features, by forcing login for certain operations. It also demonstrates the use of JSTL Expression Language in a few place.

For more information about the Wafer project, as well as implementations of the weblog in other frameworks, see http://www.waferproject.org/index.html.

webapp-2.2 and webapp-2.3

These are not full applications. The webapp samples are starter templates, with a basic configuration, build file and all the necessary jars to start building a new Chrysalis applications (though you may need to add additional jars specific to your project, such as JDBC drivers).

The webapp-2.2 sample is for Servlet 2.2 compliant web containers. The webapp-2.3 sample is for Servlet 2.3+ compliant web containers. The webapp-2.3 sample includes configuration values to support the ".view" URL, for backwards compatibility. If you only intend to use the JSP extension (.jsp), you can modify the configuration files as describe in the configuration documentation.

Unlike the other samples, these two "starter" applications are included in the no-samples distribution of Chrysalis.

Sample Application Installation

To install the sample application:

  1. Install your Servlet 2.2+ compliant server of choice (for example, Tomcat).
  2. Deploy the sample application WAR file (in Tomcat, put the sample application in Tomcat's webapps directory, and reboot Tomcat).
  3. Go to the appropriate location, based on the context path. This is probably "[host-name]/[app-name]", for example "http://localhost/catalog/"

Chrysalis uses redirections to views, and some servers are inconsistent in the way they handle the context paths for redirects. If this is a problem, try adding the following configuration value to the "WEB-INF/classes/ChrysalisConfig.xml" file:

<!-- ChrysalisConfig.xml -->
<config>
  <servlet.engine>
    <!-- Add this instruction: -->
    <server>
      <redirect prepend_context="false" />
    </server>
  </servlet.engine>
</config>

For example: Websphere needs this value to be false; Tomcat needs it to be true (which is the default if this value is omitted).

If you have issues with Chrysalis on any servers, please let us know, so we can fix them.