ray power wrote:
>
> Hi,
> As someone new to Turbine, Velocity/Webmacro & Freemarker, I also read the
> article.
> I am curious about the author's view that Freemarker is more efficient that
> either JSP or Webmacro/Velocity because it doesn't use reflection.
>
> Have I got this correct?
>
> What is the general view re. Freemarker vs. Velocity/Webmacro?
>
> Ray Power
>
Let's say your business objects more or less contain the methods that
will provide the objects and Strings that will get used in your
template:
In Velocity/WM, you can use these objects (possibly extending and
overriding methods a template engineer should not use). This is a huge
time savings in development.
In FreeMarker you need to build the complete model that will be used in
your template. This model will likely be a repeat of most parts of your
business classes with considerable amount of FreeMarker code thrown in.
This makes a pull model practically impossible except for a very simple
application. (You do not want to instantiate every object possible in
your app on every request.)
Try this, make a model starting with the modelRoot that you can use in a
FreeMarker template that includes all the properties and methods of the
following Object(s).
(assume getters/setters exist for properties)
class Object1
{
Hashtable h;
Vector v;
Object2 obj2;
Object isVinH(int i)
{
return h.get(v.get(i));
}
}
class Object2
{
int i;
boolean b;
double d;
String msg1;
String msg2;
String getMessage()
{
if (b) return msg1; else return msg2;
}
}
Now that you have this model, realize that with Velocity, you could have
avoided the entire exercise. I think it will become clear why the
WM/Velocity way of doing things is much preferred.
John McNally
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]