3. Overriding the default value

The default value of a value tag can be set from within the template itself. This can be done with the BV tag. It behaves as a regular block tag, except that the content is automatically used as the default value of a value tag with the same name. You're still able to use all block tag functionalities with it too of course.

<!--V 'warning'/-->
<!--BV 'warning'-->No warnings!<!--/BV-->

This changes the default value of the warning value to be "No warnings!". The new default value will be used if the value isn't set from the Java code.

The above template code can also be written like this and it will have exactly the same result:

<!--V 'warning'-->No warnings!<!--/V-->
<!--B 'warning'-->No warnings!<!--/B-->

The difference is however that you have to write and update exactly the same content in two different places. However, you'll notice the real benefits of the BV tag when you combine it with the include tag. This is explained in detail in the next section.