JSP's Evolution
There's another interesting discussion taking place over on the struts-dev list again. Man, I'm glad I subscribed (again) to this list last week! It started out as a discussion of JSP vs. Velocity and Craig (McClanahan) provided an interesting evolution of JSP (and comparison to Velocity).
Velocity:
========
(Note -- it's assumed that the Customer collection has been stored in the VelocityContext by some preceding business logic.) \#foreach $result in $results { <tr> <td>$result.ID</td> <td>$result.Name</td> </tr> }
JSP 1.1 (with Scriptlets):
=========================
<% Customer custs = ...; for (int i=0; i < custs.length; i++) { %> <tr> <td><%= custs[i].getId() %></td> <td><%= custs[i].getName() %></td> </tr> <% } %>
JSP 1.1 (with custom tags):
==========================
(Note -- it is assumed here and in the following examples that the
Customer collection has been stored by some preceding business logic.)
<logic:iterate id="cust" name="custs"> <tr> <td><jsp:getProperty name="cust" property="id"/></td> <td><jsp:getProperty name="cust" property="name"/></td> </tr> </logic:iterate>
JSP 1.2 + JSTL 1.0:
==================
<c:forEach var="cust" items="${custs}"> <tr> <td><c:out value="${cust.id}"/></td> <td><c:out value="${cust.name}"/></td> </tr> </c:forEach>
JSP 2.0 + JSTL 1.0:
==================
<c:forEach var="cust" items="${custs}"> <tr> <td>${cust.id}</td> <td>${cust.name}</td> </tr> </c:forEach> </pre>
I can't wait for JSP 2.0 - it's going to make everything so much easier. Once again, we have exciting times for the Java world. With the power of JSP 2.0 and XDoclet, deadlines should be a non-issue. Now we just have to figure out the best way to use them, and the fastest way to pump out a Struts project. Wouldn't it be awesome if you you could add a new column to a table, build your project using Ant and XDoclet and whalla, all your classes are updated! That would be cool - and I think it's possible. Now I just have to figure out how - and fast!
Posted by Bradley on November 23, 2002 at 04:05 AM MST #
Posted by Bradley on November 23, 2002 at 04:07 AM MST #
Posted by Matt Raible on November 23, 2002 at 11:53 AM MST #
Posted by Lance on November 23, 2002 at 03:51 PM MST #
Posted by Matt Raible on November 23, 2002 at 06:05 PM MST #
Posted by Roger van de Kimmenade on March 17, 2008 at 07:07 PM MDT #