Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is JSTL useful?

 
Sean Li
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Shawn Bayern
Author
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ricardo Marques
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ketan Khimani
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic