velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hawkes <>
Subject Re: Velocity vs JSP vs FreeMarker
Date Thu, 07 Apr 2005 16:03:28 GMT
Ryan Lea wrote:

> Just wondering if anyone has used/tried/investigated all 3 of these as
> views (from MVC) and has any opinions on them??

I tried JSP back in December and, boy, I really tried to like it but had 
some issues that clashed with my way of thinking.

I had one "top level" template with smaller templates nested inside it, and 
the only way I could pass beans to the JSP was through the global request 
collection. Therefore, if the name of a bean expected by one nested template 
clashed with the name of a bean expected by another template in the same 
request, the first would get overwritten.

In Perl I used to populate nested templates, capture their output in a 
string, then embed that string inside its container/parent template... But I 
couldn't capture the output of a JSP into a string without forking an 
internal HTTP request (insanely inefficient!). All I could do was capture 
the output of a JSP into its container using <jsp:include>, and that meant 
the variables/beans that populated all levels of all nested JSPs had to 
exist in the same global request namespace at the same time...

I was also uncomfortable about the fact a JSP is essentially a servlet, and 
it executes. That's more active than I wanted for an MVC view component. I 
wanted the view to be a static template that my program controls/populates, 
not the other way round. It was a case of the tail wagging the dog instead 
of the dog wagging the tail. I couldn't really control JSP. Instead, _it_ 
imported beans, drew values from those beans, included nested JSPs 
(executing them and capturing their output). This control wasn't available 
to my servlet. JSP was like a runaway child (?)

Ah well, that's probably just the way my brain's wired. Everyone has 
preferred ways of thinking, right? So I'm not saying JSP's inherently bad, 
just that it clashed with my programming style.

I love Velocity because it's simpler. Einstein said everything should be as 
simple as possible, but never simpler. Simplicity is an expression of power, 
the power to be direct. Complications arise because there wasn't enough 
power to be direct/simple in the first place. Oh, and about people saying 
JSP is faster, I've read lots to the contrary, saying Velocity is actually 
faster, certainly for simple templates, by as much as 40%. Can't remember 
where I got that statistic.

There are some great comments here:

Also, wasn't the reason for JSP's invention to rival technologies like ASP 
and PHP in the late 90s? In those days, embedding code in your HTML seemed 
all the rage... was popular with page designers. But we're programmers, 
right? Web applications are programs, not pages.

> <>  - the UK's number 1
> property website

Interesting. I'm returning to London in a few months - will need an 
apartment. Oh, and a job :)

Mark Hawkes
It Just Works Software
17 Colborne Street East, Suite 202
Orillia, Ontario L3V 1T4

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message