ATG Programming Guide

Subclassing Dynamo Form Handlers

A convenient way to create a form handler is to subclass a Dynamo class that implements the DropletFormHandler interface. Dynamo provides three form handler base classes that implement this interface:

atg.droplet.EmptyFormHandler

atg.droplet.GenericFormHandler

atg.droplet.TransactionalFormHandler

You can extend any of these classes to create your own form handlers.

The simplest class is called atg.droplet.EmptyFormHandler. This class implements the DropletFormHandler interface and provides empty implementations of the methods in this interface.

Dynamo also provides a class called atg.droplet.GenericFormHandler, which extends EmptyFormHandler. The GenericFormHandler class provides simple implementations of the DropletFormHandler interface’s methods and adds basic error handling logic. If errors occur in processing a form that uses GenericFormHandler, the errors are saved and exposed as properties of the form handler component. This form handler is included in the public API: see ATG API Reference for more information.

Another class called atg.droplet.TransactionalFormHandler, a subclass of the previously mentioned form handlers, treats the form processing operation as a transaction. Although the methods invoked by this form handler are processed discretely, their results are saved simultaneously. The transaction management occurs in the beforeGet and afterGet methods. This establishes the transaction before any of your properties are set or handler methods are called, rather than in the handler methods themselves. See Handler Methods for an explanation of handler methods.