This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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!
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.
Shawn Bayern<br />"JSTL in Action" <a href="http://www.jstlbook.com" target="_blank" rel="nofollow">http://www.jstlbook.com</a>
I have used some of the tags, and re-used some of them, and they have made my life a lot simpler when coding the pages. I'm not the designer, I'm the programmer, but I have to integrate pages with a great design with wahtever needs to be done dynamically on that page. Tags are a lot simpler to use than to include a bunch of java code in the page.
Sun Certified Programmer for the Java 2 Platform 1.4<p>If I can create, I will make mistakes. If I can learn with them, it must be some kind of art.
How exceedingly cool to have someone closely involved in the project to answer that question. BTW a trailing dot crept into one of those URL's, you can try http://jakarta.apache.org/taglibs/ To get to Jakarta taglibs
Is JSTL useful? Undoubtedly! Custom tags are a fantastic way of encapsulating common, recurring logic within your JSPs, and to have a standard specification and implementations that provide some of the basic (and not so basic!) tasks will save you so much time. Simon
When considering the performance which way is Best to work with JSPs: I) JSPs with Full of Scriptlets II) JSPs with JavaBeans II) JSPs with JSTL (or Custom TagLibrary) Specifically where JSTL makes the difference? Like handling XML and DB with JSTL is easier Job, But if I am using Beans then writing down DB access code in Beans is reusable. So in that case Jsp-JavaBean is better approach.