The Bean Editor application

The bean editor application uses Cocoon Forms, Pipelines and Flow to edit a simple data structure modeled by Java objects.

As such, it is a good example of how a Cocoon front-end can be used to manipulate business objects implemented in Java.

You will notice that the Java objects have nothing to do with Cocoon in our case. They are completely independent of any Cocoon libraries. This is one of the options for implementing the business layer of your application, useful when you have legacy business layer code to integrate.

Our Java beans are trivial and uninteresting: what we're looking for is an understanding of how Cocoon Pipelines, Forms and Flow play together with Java code, and for this a very simple application is certainly good.

After studying this application, you will see that very little code had to be written to implement an already capable system. As is often the case with a modular system like Cocoon, the hard part is not having to write a lot of code, but rather finding where to write the small amounts of code that are needed.

Use cases

To keep it simple and focused, this application does just three things:

  1. Display a list of tasks, units of work assigned to somebody and containing dated comments
  2. Display a single task with its comments
  3. Edit a single task, allowing comments to be added and removed
New tasks cannot be created, and tasks cannot be deleted.

The application is obviously incomplete, but shows many interesting features of the Cocoon Forms, and their interplay with the Cocoon components that we already know.

Running the application

To run the bean editor application, Cocoon must be able to load the required Java classes.

If you're running this tutorial from the standard Cocoon distribution this should be taken care of already, as the required classes are copied into the webapp/WEB-INF/lib directory automatically during the build.

When you start using your own Java classes with Cocoon, you'll have to take care of this yourself, usually by making sure the required jar files are copied in the right place.

For now, you can start the application from this link.