Lifecyle of a Jameleon Tag

When the function tag is executed, Jameleon looks for all instance variables that have a @jameleon.attribute javadoc tag. It then makes those available to the tag via either the instance variable name, or the contextName. The contextName is used to bind the value of a variable read in from an external datasource to the instance variable. This makes working with the context as easy as working with instance variables. If using the context, it is a good idea to only use the contextName in your scripts as this will not confuse others that are using external data to drive your tag.

Once all of the instance variables are set via the script, Jameleon searches for variables that aren't set, but have a default="some value" setting in the @jameleon.attribute tag and sets the value of the instance variable to the value in the default setting. Jameleon then validates that all instance variables that have required="true" in the @jameleon.attribute javadoc are set to something other than null for Objects or 0 for primitive variables. If an instance variable that is marked with required="true" is not set, then the execution of the tag completes and a message is given stating the variable was not set.

Once all of that is done, the testBlock() method is called. Every function tag should implement this method if it needs to do some sort of action, validation or navigation.