On Sat, Jan 29, 2011 at 4:49 PM, Dave Evans wrote:
> Would you like to elaborate on what makes it a poor general purpose
> templating language?
XML isn't a templating language, it's a data exchange format. XML is
human-hostile.
> The el is easy to read
The EL itself, maybe. JSP, not so much.
> and can handle nested objects, arrays and maps.
What templating language can't?
> Most importantly, since I choose to use it for my web presentation, I'd
> rather not have an entire other spec to keep track of. Why bother?
>
Because JSP is verbose. And the specs of other templating languages are much
leaner.
I am thinking about trying to duplicate/re-use/wrap/etc jstl in a
> framework for use in a non-web templates, just trying to find out if
> there is already work being done on this idea. Maybe I'll check in on
> the tomcat user list.
>
Why not check the stuff I already mentioned? There's a lot of back-end work
to get things into a context that a JSP engine can use, which is why testing
JSP fragments is horrible and is done through a container. Hence Musachy's
work, to avoid that.
But still ew. Why on earth would I want to type this (eschewing c:out):
<c:forEach items="${people}" var="person">
${person.firstName}
</c:forEach>
when I could type this?
#for (person in people)
${person.firstName}
#end
or
<#list people as person)>
${person.firstName}
</#list>
What do you gain from using JSTL? You can shove the same functionality into
a templating engine that has less cognitive overhead.
What do I *lose* from using JSP? Simplicity. Immediate out-of-container
testing. Lighter-weight. Easier. Exists.
Dave