By bloid
via javaworld.com
Published: Dec 03 2007 / 03:18
Template engines can be applied to a wide variety of development scenarios where you want to generate text based on specific processing rules, and are often used as the view component in MVC applications. In this article, Jeroen van Bergen explains where template engines fit into your application architecture and shows you some of the operations common to all template engines. Finally, he compares the two leading Java template engines, Velocity and FreeMarker, in terms of power, ease of use, and performance.
Comments
aj16780 replied ago:
Freemarker should always be preferred over Velocity. Just look at their source codes.
raveman replied ago:
Velocity is like log4j, old school. It should be deprecated, but its not. I didnt know that Freemarker has that much better preformance. I think that autor didnt say strong enought that when you use Velocity you need to manually test is it works ok(for every possible combination).
its just like
try {
// code
} catch (Exception e){
}
compared to
try {
// code
} catch (Exception e){
throw new RuntimeException(e);
}
reido56 replied ago:
I prefer FreeMarker because of its error handling. For me, the usefulness of a template engine drastically lowers if I need to spend time puzzling over what's going on.
raveman replied ago:
ps. i just found funny that author suggest that Velocity is the best
"Jeroen van Bergen started working in information technology in 1993. He has worked in the fields of billing, systems integration, and order management in the telecommunication industry. He has been programming in Java since 2000. Jeroen is at the moment mainly interested in workflow, Java-XML binding, and automatic document generation using Velocity and XSL:FO."
he knows all of them and hes using Velocity :D lazy guy, but Freemarker is not that hard to learn(Its almost the same). But some people when they get used to some technology cant leave it behind.
sproketboy replied ago:
I've been using Velocity for quite a while. I haven't seen any reason to use FreeMarker.
rolfst replied ago:
the author should have mentioned some about documentation like velocity doesn't have any that matters.
sproketboy replied ago:
er,
http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html
revusky replied ago:
There is a response to the article on the FreeMarker group blog. http://freemarker.blogspot.com/2007/12/velocity-of-freemarker-looking-at-5.html
,There is a response to the article on the FreeMarker group blog. http://freemarker.blogspot.com/2007/12/velocity-of-freemarker-looking-at-5.html
Voters For This Link (8)
Voters Against This Link (2)