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:
If you are using an
inputtag, when that form value is submitted, this method is called before thesetXmethod of the component is called. YourconvertStringToObjectmethod must generate theObjectvalue for use in thesetXmethod. It can throw aTagConversionExceptionif an error occurs during the conversion process.The
convertStringToObjectmethod for most tag converters returns null if a form field is left empty. If this method returns null, thesetXmethod for the corresponding property is not called, and the current value remains unchanged. If, instead, you want your tag converter to set the value to null when a field is left empty, yourconvertStringToObjectmethod must return the special valueTagConverterManager.SET_AS_NULL. This value instructs thesetXmethod to set the property value to null.This method is also called if you use this converter with a
paramtag when the value of the parameter is defined.
convertObjectToString
This method is called in two situations:
When you use a converter in a
valueoftag, this method is used to convert theObjectvalue into aStringvalue before displaying it.When you use this tag in an
inputtag with abeanattribute and no existingvalueattribute, this method is called to fill in thevalueattribute with the current value of the bean property.

