You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ryan Lea <Ry...@Rightmove.co.uk> on 2005/04/06 12:47:17 UTC

Velocity vs JSP vs FreeMarker

Just wondering if anyone has used/tried/investigated all 3 of these as
views (from MVC) and has any opinions on them??
 
As a bit of a site note as well, has anyone used them with WebWork??
 
cheers

Ryan Lea
Web Developer

n Email: ryan.lea@rightmove.co.uk
n Tel: 0207 318 9080
n Fax: 0207 318 9099

www.rightmove.co.uk <http://www.rightmove.co.uk/>  - the UK's number 1
property website
9 Park Place, St James's, London, SW1A 1LP

This message (including any attachments) is confidential and may be
legally privileged. The content and views expressed are those of the
sender and not necessarily rightmove.co.uk. If you are not the intended
recipient, you must not disclose, copy or use any part of it. Please
delete all copies immediately and notify the sender. Rightmove.co.uk
Limited is registered in England and Wales, No. 03997679. Registered
Office: Lavells House, 31 Hockliffe Street, Leighton Buzzard, LU7 1EZ.

 

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs service. 
________________________________________________________________________

Re: Velocity vs JSP vs FreeMarker

Posted by Daniel Dekany <dd...@freemail.hu>.
Thursday, April 7, 2005, 5:35:57 AM, jian chen wrote:

> Hi, All,
>
> I have quite some experience with JSP and Velocity. To say it short, I
> think Velocity is THE way to go. Reasons below:
>
> 1) Velocity syntax is very easy to recognize in any html template.
> Other templating systems like FreeMarker, makes it really hard to see
> what is the artificial html and what is the real one.

FreeMarker syntax admittedly has its shady sides (and also its
advantages), but... maybe it is just me, but I find it really easy to
spot FreeMarker directives in the HTML soup, since they look like
<#foo ...> and <@foo ...>. No HTML/XML tag name can start with # or @,
so it is clearly visible what is a directive and what is static text.
So, in what way are Velocity directives more visible?

Otherwise I like it similarity to HTML when I write HTML or XML
templates... like for example:

  <@fancyH1 bookmark="mediaTypes">Supported media types></...@fancyH1>

  <p>The <@k...@keyword> discs are...</p>

where fancyH1 and keyword are macros invoked above. But this last surely
just matter of taste.

-- 
Best regards,
 Daniel Dekany


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity vs JSP vs FreeMarker

Posted by Edmund Urbani <em...@liland.org>.
Will Glass-Husain wrote:
> Thanks for sharing your thoughts.
> 
> Actually, with the caching turned on serving Velocity pages is pretty 
> fast. Many say faster than JSP, though I haven't personally run any 
> benchmarks.  I agree though this isn't generally relevant in a typical 
> webapp.
> 
> I'd note that another benefit of Velocity is that you can use it for any 
> text processing (e.g. sending emails) while JSP is web only.
> 
> WILL

True. Velocity is a good general purpose templating engine. I use it for a
few things other than rendering web pages. Things that can't be done with JSP.

Malcolm Edgar wrote:
 > For development I find JSP stacktrace not very useful (JSP source code is
 > generally very ugly). With Velocity you if you stuff up you will simply see
 > your rendered Velocity code, or a useful ParsingException if you stuff up
 > really badly.

I can't quite agree with this. I use velocity with turbine and I have seen
stack-traces with velocity classes in it and no clue which template velocity
was parsing when the exception was thrown. With JSP you can tell which page
was involved because of the classname of the compiled page.
BTW I don't usually get ParsingExceptions, because my IDE (Eclipse with
Velocity Web Edit plugin) does syntax checking for me.

Jian wrote:
 > 1) Velocity syntax is very easy to recognize in any html template.
 > Other templating systems like FreeMarker, makes it really hard to see
 > what is the artificial html and what is the real one.
I agree that it is probably faster to get into (syntax-wise) than JSP.

 > 4) Velocity engine itself also provides a very small footprint I think
 > compared to the full-blown JSP engine with all the "fancy" features
 > that might get used once in a blue moon.
A servlet container like tomcat has got an integrated JSP engine. Whether
you use it or not, it's there. I'm not sure whether it's "full-blown" or
"fancy" to you. I assume "fancy" refers to JSF or some taglibs or something.

 > 5) There are much more benefits using Velocity than JSP which I don't
 > need to list here.	
Please do! :)

Florin wrote:
 > On production runtime speed: I was also concerned about the speed but I
 > found out that there are so many other speed-eating issues in a full-blown
 > webapp that the difference between rendering JSP and rendering Velocity
 > simply does not count.
Last summer I did some profiling on a turbine/velocity project. I managed to
improve performance quite significally by introducing caching in a few places.
After that the major CPU eater became java reflection (used mainly by velocity),
and it still is. Performance is OK now, but if I had to further improve it, I
would probably have to start replacing Velocity templates with JSP.

Of course you can make JSP slow by using the right (or rather: wrong) taglibs.
Also, you certainly can do a lot of weird things with some taglibs (eg. JSTL
does have SQL tags. for heaven's sake: don't use those!).

IMO one of the major disadvantages of JSP - and main reason why I switched to
velocity in the first place - is, that you cannot expect a web designer, who is
not also a Java programmer, to understand the compile errors you can get from
JSP.

But still, if everyone on the project does know enough about Java/JSP (or the
budget is big enough to take on the steep learning curve), I would prefer
JSP to velocity.

  Edmund

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity vs JSP vs FreeMarker

Posted by Will Glass-Husain <wg...@forio.com>.
Thanks for sharing your thoughts.

Actually, with the caching turned on serving Velocity pages is pretty fast. 
Many say faster than JSP, though I haven't personally run any benchmarks.  I 
agree though this isn't generally relevant in a typical webapp.

I'd note that another benefit of Velocity is that you can use it for any 
text processing (e.g. sending emails) while JSP is web only.

WILL


----- Original Message ----- 
From: "Florin Vancea" <fv...@maxiq.ro>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Wednesday, April 06, 2005 10:28 PM
Subject: Re: Velocity vs JSP vs FreeMarker


> And one more I did not see in the thread (or even elsewhere):
>
> The developer's cycle is incredibly short with Velocity (at least in my
> setup).
> I used to do JSP and with the best setup I could figure, any change in JSP
> source meant a server-side JSP recompile (good seconds lost in
> modify-compile-run-check cycle).
> With Velocity and auto-loading it's instant. And better yet, I can change
> directly the source files in the CVS'ed source tree, since I'm having a
> FileLoader hooked at development time in the loader chain.
> It's incredibly comfortable: just change and immediately see the result. 
> If
> it's good - commit directly to CVS.
>
> On production runtime speed: I was also concerned about the speed but I
> found out that there are so many other speed-eating issues in a full-blown
> webapp that the difference between rendering JSP and rendering Velocity
> simply does not count.
>
> Florin
>
> ----- Original Message ----- 
> From: "jian chen" <ch...@gmail.com>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: Thursday, April 07, 2005 6:35 AM
> Subject: Re: Velocity vs JSP vs FreeMarker
>
>
>> Hi, All,
>>
>> I have quite some experience with JSP and Velocity. To say it short, I
>> think Velocity is THE way to go. Reasons below:
>>
>> 1) Velocity syntax is very easy to recognize in any html template.
>> Other templating systems like FreeMarker, makes it really hard to see
>> what is the artificial html and what is the real one.
>>
>> 2) Speed-wise, who cares if JSP is some millisecond faster or not.
>> Given any reasonable machine, Velocity is good enough.
>>
>> 3) Velocity is WAY much simpler than the JSP mess. To be honest, I
>> don't like Sun's approach to make things unnecessarily complicated,
>> such as the JSP tag lib crap.
>>
>> To a java developer who never does Web development, Velocity is a lot
>> easier to pick up, while you need to read a lot in order to master the
>> JSP intricacies (again due to the fact Sun introduced lot of features
>> in JSP which only make developers clueless, JSF, JSTL, etc.)
>>
>> 4) Velocity engine itself also provides a very small footprint I think
>> compared to the full-blown JSP engine with all the "fancy" features
>> that might get used once in a blue moon.
>>
>> 5) There are much more benefits using Velocity than JSP which I don't
>> need to list here.
>>
>> Overall, Velocity is small, simple and efficient. That is what I like it
> best.
>>
>> Jian
>>
>>
>> On Apr 6, 2005 8:26 AM, Edmund Urbani <em...@liland.org> wrote:
>> > 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??
>> > >
>> > > As a bit of a site note as well, has anyone used them with WebWork??
>> > >
>> > > cheers
>> > >
>> > > Ryan Lea
>> > > Web Developer
>> > >
>> >
>> > I have got experience with JSP and Velocity (never used FreeMarker or
> WebWork).
>> > I started with JSP a few years back, then I switched to Velocity and
>> > right now I am considering to go back to JSP for a new project.
>> >
>> > Both allow developers to stick to MVC and create nice, clean,
> maintainable pages.
>> > Both allow developers to mess around.
>> >
>> > Velocity does have a nice syntax for simple things like iterations, 
>> > ifs,
> sets
>> > and you can define macros, which can be very useful to let templates
> share
>> > things. You need no Java code to do this, it's all built-in. You can 
>> > not
>> > include Java Code in your templates (that may be considered both - a
> good and
>> > a bad thing). Velocity does unexpected things with null values, or
> rather it does
>> > not do anything with them besides writing to the log.
>> >
>> > In comparison JSPs are faster (once they have been compiled) and they
> will always
>> > be, because they do not rely on reflection/bean mechanisms. To me, the
> fact
>> > that JSP is compiled to Java classes is its biggest advantage over
> templating engines
>> > like Velocity, and the reason why I am considering switching back to 
>> > it.
>> > Compiling does inform you about many sorts of errors you can make EARLY
> (build-time
>> > vs run-time). Also, because JSPs do get translated to Java Code, I can
> use all kinds
>> > of Java development tools on them. Eg. I can take a look at the call
> hierarchie
>> > of one of my methods and see which JSPs use that method (that advantage
> can be
>> > eliminated by using <jsp:bean /> tags instead of simply calling
> get-methods).
>> >
>> > Well, now that I have said that much in favor of JSP, I can already 
>> > feel
> the wrath
>> > of the velocity community upon me - just kidding ;)
>> >
>> > I hope that someone will speak in favor of Velocity on this list 
>> > though!
>> >
>> > Cheers
>> >   Edmund
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity vs JSP vs FreeMarker

Posted by Florin Vancea <fv...@maxiq.ro>.
And one more I did not see in the thread (or even elsewhere):

The developer's cycle is incredibly short with Velocity (at least in my
setup).
I used to do JSP and with the best setup I could figure, any change in JSP
source meant a server-side JSP recompile (good seconds lost in
modify-compile-run-check cycle).
With Velocity and auto-loading it's instant. And better yet, I can change
directly the source files in the CVS'ed source tree, since I'm having a
FileLoader hooked at development time in the loader chain.
It's incredibly comfortable: just change and immediately see the result. If
it's good - commit directly to CVS.

On production runtime speed: I was also concerned about the speed but I
found out that there are so many other speed-eating issues in a full-blown
webapp that the difference between rendering JSP and rendering Velocity
simply does not count.

Florin

----- Original Message ----- 
From: "jian chen" <ch...@gmail.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Thursday, April 07, 2005 6:35 AM
Subject: Re: Velocity vs JSP vs FreeMarker


> Hi, All,
>
> I have quite some experience with JSP and Velocity. To say it short, I
> think Velocity is THE way to go. Reasons below:
>
> 1) Velocity syntax is very easy to recognize in any html template.
> Other templating systems like FreeMarker, makes it really hard to see
> what is the artificial html and what is the real one.
>
> 2) Speed-wise, who cares if JSP is some millisecond faster or not.
> Given any reasonable machine, Velocity is good enough.
>
> 3) Velocity is WAY much simpler than the JSP mess. To be honest, I
> don't like Sun's approach to make things unnecessarily complicated,
> such as the JSP tag lib crap.
>
> To a java developer who never does Web development, Velocity is a lot
> easier to pick up, while you need to read a lot in order to master the
> JSP intricacies (again due to the fact Sun introduced lot of features
> in JSP which only make developers clueless, JSF, JSTL, etc.)
>
> 4) Velocity engine itself also provides a very small footprint I think
> compared to the full-blown JSP engine with all the "fancy" features
> that might get used once in a blue moon.
>
> 5) There are much more benefits using Velocity than JSP which I don't
> need to list here.
>
> Overall, Velocity is small, simple and efficient. That is what I like it
best.
>
> Jian
>
>
> On Apr 6, 2005 8:26 AM, Edmund Urbani <em...@liland.org> wrote:
> > 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??
> > >
> > > As a bit of a site note as well, has anyone used them with WebWork??
> > >
> > > cheers
> > >
> > > Ryan Lea
> > > Web Developer
> > >
> >
> > I have got experience with JSP and Velocity (never used FreeMarker or
WebWork).
> > I started with JSP a few years back, then I switched to Velocity and
> > right now I am considering to go back to JSP for a new project.
> >
> > Both allow developers to stick to MVC and create nice, clean,
maintainable pages.
> > Both allow developers to mess around.
> >
> > Velocity does have a nice syntax for simple things like iterations, ifs,
sets
> > and you can define macros, which can be very useful to let templates
share
> > things. You need no Java code to do this, it's all built-in. You can not
> > include Java Code in your templates (that may be considered both - a
good and
> > a bad thing). Velocity does unexpected things with null values, or
rather it does
> > not do anything with them besides writing to the log.
> >
> > In comparison JSPs are faster (once they have been compiled) and they
will always
> > be, because they do not rely on reflection/bean mechanisms. To me, the
fact
> > that JSP is compiled to Java classes is its biggest advantage over
templating engines
> > like Velocity, and the reason why I am considering switching back to it.
> > Compiling does inform you about many sorts of errors you can make EARLY
(build-time
> > vs run-time). Also, because JSPs do get translated to Java Code, I can
use all kinds
> > of Java development tools on them. Eg. I can take a look at the call
hierarchie
> > of one of my methods and see which JSPs use that method (that advantage
can be
> > eliminated by using <jsp:bean /> tags instead of simply calling
get-methods).
> >
> > Well, now that I have said that much in favor of JSP, I can already feel
the wrath
> > of the velocity community upon me - just kidding ;)
> >
> > I hope that someone will speak in favor of Velocity on this list though!
> >
> > Cheers
> >   Edmund
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity vs JSP vs FreeMarker

Posted by jian chen <ch...@gmail.com>.
Hi, All,

I have quite some experience with JSP and Velocity. To say it short, I
think Velocity is THE way to go. Reasons below:

1) Velocity syntax is very easy to recognize in any html template.
Other templating systems like FreeMarker, makes it really hard to see
what is the artificial html and what is the real one.

2) Speed-wise, who cares if JSP is some millisecond faster or not.
Given any reasonable machine, Velocity is good enough.

3) Velocity is WAY much simpler than the JSP mess. To be honest, I
don't like Sun's approach to make things unnecessarily complicated,
such as the JSP tag lib crap.

To a java developer who never does Web development, Velocity is a lot
easier to pick up, while you need to read a lot in order to master the
JSP intricacies (again due to the fact Sun introduced lot of features
in JSP which only make developers clueless, JSF, JSTL, etc.)

4) Velocity engine itself also provides a very small footprint I think
compared to the full-blown JSP engine with all the "fancy" features
that might get used once in a blue moon.

5) There are much more benefits using Velocity than JSP which I don't
need to list here.

Overall, Velocity is small, simple and efficient. That is what I like it best.

Jian


On Apr 6, 2005 8:26 AM, Edmund Urbani <em...@liland.org> wrote:
> 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??
> >
> > As a bit of a site note as well, has anyone used them with WebWork??
> >
> > cheers
> >
> > Ryan Lea
> > Web Developer
> >
> 
> I have got experience with JSP and Velocity (never used FreeMarker or WebWork).
> I started with JSP a few years back, then I switched to Velocity and
> right now I am considering to go back to JSP for a new project.
> 
> Both allow developers to stick to MVC and create nice, clean, maintainable pages.
> Both allow developers to mess around.
> 
> Velocity does have a nice syntax for simple things like iterations, ifs, sets
> and you can define macros, which can be very useful to let templates share
> things. You need no Java code to do this, it's all built-in. You can not
> include Java Code in your templates (that may be considered both - a good and
> a bad thing). Velocity does unexpected things with null values, or rather it does
> not do anything with them besides writing to the log.
> 
> In comparison JSPs are faster (once they have been compiled) and they will always
> be, because they do not rely on reflection/bean mechanisms. To me, the fact
> that JSP is compiled to Java classes is its biggest advantage over templating engines
> like Velocity, and the reason why I am considering switching back to it.
> Compiling does inform you about many sorts of errors you can make EARLY (build-time
> vs run-time). Also, because JSPs do get translated to Java Code, I can use all kinds
> of Java development tools on them. Eg. I can take a look at the call hierarchie
> of one of my methods and see which JSPs use that method (that advantage can be
> eliminated by using <jsp:bean /> tags instead of simply calling get-methods).
> 
> Well, now that I have said that much in favor of JSP, I can already feel the wrath
> of the velocity community upon me - just kidding ;)
> 
> I hope that someone will speak in favor of Velocity on this list though!
> 
> Cheers
>   Edmund
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity vs JSP vs FreeMarker

Posted by Edmund Urbani <em...@liland.org>.
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??
>  
> As a bit of a site note as well, has anyone used them with WebWork??
>  
> cheers
> 
> Ryan Lea
> Web Developer
> 

I have got experience with JSP and Velocity (never used FreeMarker or WebWork).
I started with JSP a few years back, then I switched to Velocity and
right now I am considering to go back to JSP for a new project.

Both allow developers to stick to MVC and create nice, clean, maintainable pages.
Both allow developers to mess around.

Velocity does have a nice syntax for simple things like iterations, ifs, sets
and you can define macros, which can be very useful to let templates share
things. You need no Java code to do this, it's all built-in. You can not
include Java Code in your templates (that may be considered both - a good and
a bad thing). Velocity does unexpected things with null values, or rather it does
not do anything with them besides writing to the log.

In comparison JSPs are faster (once they have been compiled) and they will always
be, because they do not rely on reflection/bean mechanisms. To me, the fact
that JSP is compiled to Java classes is its biggest advantage over templating engines
like Velocity, and the reason why I am considering switching back to it.
Compiling does inform you about many sorts of errors you can make EARLY (build-time
vs run-time). Also, because JSPs do get translated to Java Code, I can use all kinds
of Java development tools on them. Eg. I can take a look at the call hierarchie
of one of my methods and see which JSPs use that method (that advantage can be
eliminated by using <jsp:bean /> tags instead of simply calling get-methods).

Well, now that I have said that much in favor of JSP, I can already feel the wrath
of the velocity community upon me - just kidding ;)

I hope that someone will speak in favor of Velocity on this list though!

Cheers
  Edmund

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity vs JSP vs FreeMarker

Posted by Malcolm Edgar <ma...@gmail.com>.
Hi Ryan,

I evaluated FreeMarker for use in the Click web app framework, but
Velocity came out ahead its much easier to read and use.  One problem
with FreeMarker, and JSP is that they use a half baked XML syntax
which isn't HTML, but looks close enough to be confusing. Also XML
style syntax do not express conditional logic at all well.  The Struts
logic tag lib is a case in point, have to do an if else if logic you
will end up with

<logic:equals name="customer" property="category" value="gold">
  <span>blah</span>
</logic:equals>
<logic:equals name="customer" property="category" value="silver">
  <span>blah</span>
<logic:equals> 

You get is problem in Tapestry as well, where you hide logic in span
elements. The HTML becomes hard to read as you dont know what is
presentation and what is logic.

>From what I have seen WebWork is a better implemantation of Struts,
but its still a relatively simple command pattern web framework.

<plug>Take a look at Click at http://click.sourceforge.net</plug>

regards Malcolm Edgar

On Apr 6, 2005 8:47 PM, Ryan Lea <Ry...@rightmove.co.uk> wrote:
> Just wondering if anyone has used/tried/investigated all 3 of these as
> views (from MVC) and has any opinions on them??
> 
> As a bit of a site note as well, has anyone used them with WebWork??
> 
> cheers
> 
> Ryan Lea
> Web Developer
> 
> n Email: ryan.lea@rightmove.co.uk
> n Tel: 0207 318 9080
> n Fax: 0207 318 9099
> 
> www.rightmove.co.uk <http://www.rightmove.co.uk/>  - the UK's number 1
> property website
> 9 Park Place, St James's, London, SW1A 1LP
> 
> This message (including any attachments) is confidential and may be
> legally privileged. The content and views expressed are those of the
> sender and not necessarily rightmove.co.uk. If you are not the intended
> recipient, you must not disclose, copy or use any part of it. Please
> delete all copies immediately and notify the sender. Rightmove.co.uk
> Limited is registered in England and Wales, No. 03997679. Registered
> Office: Lavells House, 31 Hockliffe Street, Leighton Buzzard, LU7 1EZ.
> 
> ________________________________________________________________________
> This email has been scanned for all viruses by the MessageLabs service.
> ________________________________________________________________________
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity vs JSP vs FreeMarker

Posted by Mark Hawkes <ha...@onetel.com>.
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:

   http://www.russellbeattie.com/notebook/1006966.html

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.

> www.rightmove.co.uk <http://www.rightmove.co.uk/>  - 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
1-705-326-4254


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity vs JSP vs FreeMarker

Posted by Barbara Baughman <ba...@utdallas.edu>.
Speaking only to the issue of JSP vs. Velocity, I have done both.  I
found JSP to be a maintenance nightmare.  Even though, in many of my
projects I am both the M, V, and C person, I find it so much easier to
maintain if I organize the business logic in the programs and have
something very simple for the view part.

Other pluses:
1.) Easy to learn and write for anyone who can also do HTML.

2.) No need to worry about a designer-type messing with your program
code.  In fact, I handed over the web design for one of my major
projects to someone else last year, with no fear and great results.

3.) Changes to the template presentation details happen immediately,
without compiling or restarting.

4.) Less likelihood of giving a stack trace to a user.  In fact, I
don't know that I've ever seen it.  The template breaks, but the user
generally gets a blank screen, or the output stops sooner that
anticipated.

5.) Easy to troubleshoot the templates.  Since changes appear
immediately, you can easily play with them to get the look you want.
The Velocity Log explains problems with parsing, templates not found,
invalid methods, references not found, etc., giving the template name,
line number, character number, and a short explanation.

Barbara Baughman
X2157


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity vs JSP vs FreeMarker

Posted by Daniel Dekany <dd...@freemail.hu>.
Answers has to be read with great reservations if you, for example, ask
on a U2 mailing list if which is the better: U2 vs Pink Floyd vs Depeche
Mode. Guess what will be the answer... :)


Wednesday, April 6, 2005, 12:47:17 PM, 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??
>
> As a bit of a site note as well, has anyone used them with WebWork??
>
> cheers

-- 
Best regards,
 Daniel Dekany


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity vs JSP vs FreeMarker

Posted by jian chen <ch...@gmail.com>.
Hi,  Steve,

I totally agree with you.

Using JSP, it is very easy to lose sight of the MVC pattern when
development is under release pressure. I have seen people putting JDBC
database code directly in JSP because it is lot easier to do and so to
meet development deadline. Afterwards, that page with all the java
code inside it was too long and ugly to be even debugged.

Not proper used, JSP pages are a maintenance nightmare. Also I should
say the possibility that JSP is not properly used is very high.

Cheers,

Jian

On Apr 7, 2005 8:52 AM, Steve O'Hara <so...@pivotal-solutions.co.uk> wrote:
> 
> My tuppence worth........
> 
> Velocity outstrips JSP in one fundamental way that even as a Java developer,
> I can't refute - the fact that practically any HTML geek can use it without
> a crash course in Java.
> 
> Aso, I've used JSP a lot and the tendency is to end up losing site of the
> MVC paradigm and ending up stuffing lots of application code into the
> display.
> 
> As for performance, that's not an issue - the very minor performance benefit
> of JSP is insignificant compared to overall application losses caused by the
> servlet container, comms transport and browser rendering.  Lets face it, if
> performance was a major factor you wouldn't be using Java in the first
> place!
> 
> Steve
> 
> 
> -----Original Message-----
> From: Ryan Lea [mailto:Ryan.Lea@Rightmove.co.uk]
> Sent: 06 April 2005 11:47
> To: velocity-user@jakarta.apache.org
> Subject: Velocity vs JSP vs FreeMarker
> 
> Just wondering if anyone has used/tried/investigated all 3 of these as
> views (from MVC) and has any opinions on them??
> 
> As a bit of a site note as well, has anyone used them with WebWork??
> 
> cheers
> 
> Ryan Lea
> Web Developer
> 
> n Email: ryan.lea@rightmove.co.uk
> n Tel: 0207 318 9080
> n Fax: 0207 318 9099
> 
> www.rightmove.co.uk <http://www.rightmove.co.uk/>  - the UK's number 1
> property website
> 9 Park Place, St James's, London, SW1A 1LP
> 
> This message (including any attachments) is confidential and may be
> legally privileged. The content and views expressed are those of the
> sender and not necessarily rightmove.co.uk. If you are not the intended
> recipient, you must not disclose, copy or use any part of it. Please
> delete all copies immediately and notify the sender. Rightmove.co.uk
> Limited is registered in England and Wales, No. 03997679. Registered
> Office: Lavells House, 31 Hockliffe Street, Leighton Buzzard, LU7 1EZ.
> 
> ________________________________________________________________________
> This email has been scanned for all viruses by the MessageLabs service.
> ________________________________________________________________________
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Velocity vs JSP vs FreeMarker

Posted by Mark Hawkes <ha...@onetel.com>.
Steve O'Hara wrote:

> As for performance, that's not an issue - the very minor performance benefit
> of JSP is insignificant compared to overall application losses caused by the
> servlet container, comms transport and browser rendering.  Lets face it, if
> performance was a major factor you wouldn't be using Java in the first
> place!

I don't know. Servlets are pretty fast - as good if not faster than 
mod_perl, ASP.NET and PHP.

I guess the real speed freaks would write their web app in C, then compile 
it to an Apache module and statically link it into Apache. That way, your 
web app kind of _is_ your web server :)

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


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


RE: Velocity vs JSP vs FreeMarker

Posted by Steve O'Hara <so...@pivotal-solutions.co.uk>.
My tuppence worth........

Velocity outstrips JSP in one fundamental way that even as a Java developer,
I can't refute - the fact that practically any HTML geek can use it without
a crash course in Java.

Aso, I've used JSP a lot and the tendency is to end up losing site of the
MVC paradigm and ending up stuffing lots of application code into the
display.

As for performance, that's not an issue - the very minor performance benefit
of JSP is insignificant compared to overall application losses caused by the
servlet container, comms transport and browser rendering.  Lets face it, if
performance was a major factor you wouldn't be using Java in the first
place!

Steve





-----Original Message-----
From: Ryan Lea [mailto:Ryan.Lea@Rightmove.co.uk]
Sent: 06 April 2005 11:47
To: velocity-user@jakarta.apache.org
Subject: Velocity vs JSP vs FreeMarker


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

As a bit of a site note as well, has anyone used them with WebWork??

cheers

Ryan Lea
Web Developer

n Email: ryan.lea@rightmove.co.uk
n Tel: 0207 318 9080
n Fax: 0207 318 9099

www.rightmove.co.uk <http://www.rightmove.co.uk/>  - the UK's number 1
property website
9 Park Place, St James's, London, SW1A 1LP

This message (including any attachments) is confidential and may be
legally privileged. The content and views expressed are those of the
sender and not necessarily rightmove.co.uk. If you are not the intended
recipient, you must not disclose, copy or use any part of it. Please
delete all copies immediately and notify the sender. Rightmove.co.uk
Limited is registered in England and Wales, No. 03997679. Registered
Office: Lavells House, 31 Hockliffe Street, Leighton Buzzard, LU7 1EZ.



________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs service.
________________________________________________________________________




---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org