Originally posted by Sean Lee:
I've read the sun's tutorial of JSTL, I don't think that will be convenient but bothersome. Maybe i just cannot go through into it. Is there any experts here can tell me the really usage of that technique? thanks!
Well, I'm the reference-implementation lead for JSTL, so I'm hardly unbiased, but I think JSTL offers a clear, evoluationary advantage over prior ways of writing
JSP pages. Keep in mind that JSTL is aimed primarily at page authors -- those whose job it is to design and publish pages using HTML or other markup languages. If you're a hard-core programmer, it's not primarily intended for you, although there are many things about it that will probably be convenient anyway.
For example, JSTL offers an "imperative" approach toward XML manipulation, which is substantially easier than XSLT's approach. Instead of writing functional, recursive stylesheets, you can simply say, "Find the first <p> element and print out its content," or "loop over every <item> element, printing out its 'id' attribute." You'll find tags for such functions in JSTL's "XML" library.
The other JSTL libraries are similarly convenient -- they provide easy ways to access databases, format text, and so forth. I programmed a large portion of JSTL's tags, and I
still find it useful to use JSTL's tags rather than to rewrite functionality in
Java.
I'd take a look at the newest version of JSTL; the standard is about to become finalized, and the Proposed Final Draft is available through
http://java.sun.com/products/jsp/jstl. At Jakarta Taglibs, we provide a complete, product-quality reference implementation of the tags: it's the "Standard Taglib" available through
http://jakarta.apache.org/taglibs. In my upcoming book, I describe some of the more specific advantages of JSTL.
Please let me know if you have any questions, or if you're still not clear on JSTL's purpose. Its major goal is to support the separation of business logic from presentation logic by letting you write JSTL pages without using any Java. Scriptlets are notoriously unmaintainable, difficult to debug, and hard for nonprogrammers to work with; JSTL is, by contrast, much easier to maintain and more accessible to nonprogrammers.