On 9/6/2002 at 4:46 PM Martin Cooper wrote:

>If you're using a JSP 1.2 container (e.g. Tomcat 4.x, Resin 2.x), you can
>do
>this (and many other cool things) using the JSTL <c:forEach> tag:
>
>  <c:forEach items="items" var="item" varStatus="status">
>    <c:out value="${item}"/>
>    <c:if test="${!status.last}">
>      ...is followed by...
>    </c:if>
>  </c:forEach>
>
>This is a great reason to start getting familiar with JSTL. :-)

(sorry for resurrecting an old thread, I neglected to post my thoughts
earlier)

This is what totally bugs me about JSP pages, I'm curious to see if anyone
else here shares my concerns. Early JSP pages freely mingled java code
(scriptlets) and html markup. This development style was quickly seen to be
poor for a few reasons:

* java coders and html designers had to edit the same files, causing no end
of confusion and synchronization problems

* the intermingling of logic and design makes pages messy and hard to
maintain

* it was difficult to reuse code from page to page, except by cutting and
pasting

Taglibs are offered as a solution for this, but I wonder how effective they
really are at solving these problems. Instead of writing <% for (int i=0;
i<... etc %> you write <c:forEach pre="{$i}=0" ... > or what have you.
Okay, it's arguably nicer looking and easier to validate since it tends to
follow standard xml syntax rules instead of the <% %> hacks, but does it
really solve the aforementioned problems? Sure, disciplined developers can
reuse code more easily by writing (and debugging!) their own taglibs, but
the first two problems remain.

And in the end condition, when you can do anything using JSTL or whatever
other taglibs that you could have written in Java, haven't you just come up
with an xml grammar for the Java language? Which might be intellectually
interesting, but who wants to _program_ using a verbose syntax like xml?
(If you wanted to use lisp, go ahead and use lisp. :))

I'm obviously not a jsp devotee. I think xslt is the natural bridge between
the model objects and the html view. But millions of jsp coders can't be
all wrong, right? What benefits am I glossing over or disregarding? 

- donald


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to