JSP Standard Tag Libraries 1.0 Final Specification Available


News: JSP Standard Tag Libraries 1.0 Final Specification Available

  1. The final version of the Java Server Page Standard Tab Library (JSTL) 1.0 spec is now available. The JSTL defines a set of standard tags with functionality ranging from standard control flow, SQL access, i18N formatting, etc. JSTL also fully supports the new expression language under development in the JSP 2.0 spec.

    Download JSP Standard Tag Libraries Final.

    Read JSR 52: JSP Standard Tag Libraries.

    Threaded Messages (22)

  2. where can I get some sample ? who can offer me ,thanks:-)
  3. http://java.sun.com/products/jsp/jstl/index.html

    check the book
    JSTL in Action, Shawn Bayern, Manning
  4. check
  5. When you download the JSTL 1.0 distribution (available from the Jakarta site), you get a prebuilt web application (standard-examples.war) that you can drop straight into a JSP 1.2 compliant container such as Tomcat 4.

    Certainly worth a look as there's some great stuff in there...

    Author of Professional JSP Tag Libraries (sample chapters available)
  6. I have already played a lot with the JSTL (reference implementation and also Resin's optimizations), and I have to say that I really like it. I have not been too keen on tag libraries for nearly two years, but that changes currently.

    Especially valuable is the handling of localization and i18n resource bundles, formatting and parsing, conditions and iterations. A lot of Java code in JSPs can be replaced in a standardized way now, with JSTL tags. And the focus on error tolerance in the expression language is great for page scripting: No more "!= null" checks for dependent objects.

    I'm still concerned about efficient tag handling and EL expression evaluation, though. Due to its heavy usage of reflection EL has to be slower than Java scriptlets. And you lose static type checks and compile-time error messages. But it seems to me that its ease of use more than compensates for these drawbacks.

    Altogether a great addition to the Java web app developer's toolkit!

  7. Indeed, the JSTL is an excellent tag library. The JCP really did a good job on this. I am currently using it in a small web app, originally written with Struts. I was able to replace all the tags from the Struts tag libraries "struts-bean" e "struts-logic" with tags from the JSTL's "core" tag library. I am also using the "fmt" JSTL tag library, to format number and dates.
    I wouldn't recommend using the "sql" and "xml" tags, though, since that is better done outside the JSP files.
    The EL may incur a performance penalty now, but this will change next year, after JSP 2.0 is out: one of its main goals is to incorporate JSTL's expression language (possibly with some modification) in JSP itself, which will also allow its use in template text, not only in tag attributes.
  8. I wouldn't be worried about the performance hit of reflection, unless you're using a very old JDK. The last two versions, at least, have both made huge improvements in performance, to the point where there's really no reason to worry about the cost of using it any more.
  9. Okie I know that doing SQL Stuff directly in JSP page is not the best way to do thing, but if I want to populate a list(drop down box ex: Product Name), and all this information are drawing out from the database. How would I do it. I mean what is the best way to do this other than using the JSP Tag.

  10. Here is how you could do it using the Struts "html" tag library:

    <html:select name="myBean" property="productName">
      <html:options name="myBean" property="productNames"/>

    where "myBean" is a session or request attribute pointing to an instance of say, "com.acme.ProductForm" (a JavaBean), and "productNames" is a method that returns a collection populated from a "products" table.

    This is just one way of doing it, without embedding any SQL code in the JSP page.
  11. I'm using struts to develop an application. I have an action, that has an input page, and a result page. However, the input page needs information that is in the model. Following mvc, I canĀ“t access the model directly from view. With struts, the input page is called before calling the action. Strictly following MVC, how can I populate the input page with model info I need?

    The example you did is fine, however, how did you create/populate the bean myBean first? Where you did it?
  12. Hi Andre,

    You can find answers for these questions in the open source JPetStore web application, which is implemented with Struts.
    You can find it here: iBATIS JPetStore

    (I actually don't use Struts, because I think it's too complicated for what it does, and the use of JSP tags such as <html:text> is not what want to see in a JSP page that produces HTML.)



  13.    From the introduction of the spec, it says it is for Nonprogrammers. How many of us here really are not programmers? Is it really true a nonprogrammer can use the thing? I found the flow control part is really awkward. This may inherit(emulate) from XSLT. May it has some good stuff, howerver claiming the ... is for people who don't understand programming languges is just misleading.
  14. That's the problem. We ARE programmers and using tags is a step backwards. Tags suck. Tags are for Html authors. JSPs suck. Reflection sucks. Use presentation servlets with RAW Java.
  15. I don't agree that using tags is a step backwards, and I don't care what they say in the spec with respect to whom they are targetted. I would glady give up a general purpose programming language for a more high level, declarative language, that is focused on the problem at hand (in this case, expressing an UI design). Generating HTML with raw Java code in a servlet is the real step backwards, IMO.

  16.    Tag libraries may be convenient for something absolutely necessary. I feel that people go too far in this direction. Like struts, it invented every tag html has. You also find these standards, specs and implementations trying to copy or emulate from each other. You really don't know these stuffs make developers' life easier or more miserable. This may be just a phrase of the evolution process anyway.

  17. Have you ever used the ElementConstructionSet? It's a very efficient way to write Html.
  18. So, you say that writing this (from Jakarta ECS):

    Document doc = new Document()
                  .appendBody(new H1("Demo Header"))
                  .appendBody(new H3("Sub Header:"))
                  .appendBody(new Font().setSize("+1")
                             .addElement("The big dog & the little cat chased each other."));

    is actually preferable to writing this:

      <h1>Demo Header</h1>
      <h3>Sub Header:</h3>
      <font size="+1" color="red" face="Times">The big dog & the little cat chased each other.</font>

    (Note that this HTML code works, as can be verified in a browser, without requiring the use "&#38;" or "#FF0000" as stated in the Jakarta ECS page.)

    Well, maybe it's just me, but I would choose the HTML version any day (even though I am a Java/C/C++/VB/XSL programmer). And if you consider using CSS instead of that ugly, deprecated, <font> tag, it would be even easier (Can ECS do what CSS does? If not, why should I give up a fantastic technology such as CSS, in exchange for a lot of repetitive Java code?)


  19. No man. Don't use it for all of the Html. Iterative things, looping, etc. Like building a table or a select control. And yes, CSS is easily used with ECS.

    TD td = new TD();

  20. Why not just use JSTL, if all you need is loops and conditionals? Note that I took the ECS example code right from Jakarta ECS front page. And if you just use ECS to set the name of a CSS class, what's the point? You are really using CSS, not ECS (which would imply having an API capable of attaching and expressing style specifications, in ECS itself).
  21. Hi there. I'm the RI lead for JSTL and the author of "JSTL in Action." (It was great to see someone mention it earlier!) I'm encouraged by all the great positive feedback we've gotten for JSTL here -- I'm very pleased that people are finding it useful and efficient.

    I'm just writing to mention that my publisher, Manning, will be making the entire text of "JSTL in Action" available for free online in PDF format. Feel free to visit http://www.jstlbook.com for updates; I've been keeping that page up to date and will add links once the PDFs are available. (The printed book itself will ship on July 29, I'm told.)

    I'm always happy to answer any questions about the JSTL RI on taglibs-user at jakarta dot apache dot org or through personal email (bayern at essentially dot net), in case that's useful.

    Shawn Bayern
    Preorder JSTL in Action"
  22. One other thing: If I were to use presentation servlets instead of JSP, I could easily use inheritance.
  23. dfd,

    I agree with your point. Explaining what a collection is, and where did it came from is a hard task when you're dealing with a designer. I suffered it. However, one thing is for sure: if you keep your explanation simple, not getting down to details, it's possible. And it's far better than RAW java or jsp scriptlets, from a maintenance perspective.