Show output as a xml file using Velocity Posted on: August 27, 2008 at 12:00 AM
This Example shows you how to show output as a xml file in velocity.
Show output as a xml file using Velocity
Example shows you how
to show output as a xml file in velocity. The method
used in this example are
1:- Initialize velocity run
engine through method init().
2:- Create object of
3:- Create Template
class object, Template
class object is used for
controlling template methods and properties.
template.merge(context, writer): Merge method of the Template class
is used here for
merging the VelocityContext class object to produce
#foreach( $stu in $stuList ): This works same as the for loop
of java but with some enhanced functionality.
Here in the code given below we will take some values in map object and then add
this map object in list. With the help this list object we will create output
for all the given values as a xml file.