A TagConverter class must implement the following four methods of the atg.droplet.TagConverter interface:

getName

Returns the name of your converter. This is the name that is used as an argument to the converter attribute in a tag. For example, Dynamo has a converter whose getName method returns currency, so you can include a tag like this in your JavaServer Pages:

<dsp:valueof param="myPrice" converter="currency"/>

getTagAttributeDescriptors

Returns the list of attribute arguments that this converter takes. These attributes are listed along with the converter attribute in your valueof, input, or param tag. These attributes can be marked as optional if they are not required. For example, the currency converter takes a locale attribute that is optional. The default behavior if this attribute is missing is to use the locale associated with the current request.

A TagAttributeDescriptor also can be marked as automatic, which means that this attribute implies the use of this converter, even if the converter attribute is not specified. For example, the currency converter defines a currency attribute that is automatic, so you can use this converter in your page with:

<dsp:valueof param="myPrice" currency/>

You cannot have more than one converter registered with the same automatic attribute. You can replace an existing converter by registering a new one with the same name (after the existing converter has already been registered).

It is legal to define a TagConverter that takes the same attribute as another TagConverter as long as it is not ambiguous which converter to use for a given tag. The required attribute is an automatic attribute for the RequiredTagConverter. The DateTagConverter has date as an automatic attribute and required as an optional attribute. If you use both date and required in the same tag, the DateTagConverter is used. If you use just required, the RequiredTagConverter is used.

convertStringToObject

This method is called in two circumstances:

convertObjectToString

This method is called in two situations:

 
loading table of contents...