On Wed, 11 Sep 2002, Dror Matalon wrote: > How would development with the expression language compare to using a > template engine like Velocity in your opinion? It seems that there's a > lot of overlapping functionality.
One very specific (but I think very important) difference between the proposed JSP 2.0 EL and Velocity is that JSP lets a back-end developer provide abstractions of low-level data types for page authors. The Velocity EL, by contrast, lets you call arbitrary methods on Java objects. As an example of this, consider JSTL's <c:forEach> tag, which loops over any standard J2SE Collection object, arrays, etc. A page author might not be familiar with the specific types involved; he or she might simply be told, "object 'cart' is something you can loop over." It doesn't matter if 'cart' is an array or a List. Now, a language that lets you call an object's size() method, as in ${cart.size()} presumes that the user of 'cart' is familiar with the type of the object, or at least with the methods of each object. If 'cart' is an array, the expression won't work; it'll only work if it's a Collection. In the JSP 2.0 EL, you'd write the expression differently; a programmer (or, just hypothetically JSTL 1.1) could provide a "size" function that operates on the same data types as <c:forEach>. You'd end up with ${size(cart)} but more importantly, you'd preserve the illusion that all objects that contain other objects operate in the same manner, at least from the perspective of a page author. -- Shawn Bayern "JSTL in Action" http://www.jstlbook.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com