JavaServer Pages Standard Tag Library

The JavaServer Pages Standard Tag Library ( abbreviated to JSTL ) is a collection of four custom tag libraries that are useful for creating JSP pages.

The JSTL is managed as part of the Java Community Process (JCP ) under JSR 052. Within the Jakarta project there is to this specification reference implementations.

Components

In version 1.1, the following libraries are provided:

  • Core: iterative, conditional, URL - specific and general tags
  • I18n: tags for formatting and internationalization

History

In the original version 1.0 compared to version 1.1 an expression language was provided. With JSP 2.0, the JSP EL was included in the JSP specification itself. The primary goal of JSTL 1.1 is accordingly adapting the library to the JSP EL for JSP 2.0. With version 1.2 of the JSTL library is brought up to date with regard to the standardization of the expression language by the JSP 2.1 and JSF 1.2 specifications. Furthermore, the JSTL version 1.2 of the Java EE 5 platform.

Using the JSTL 1.1

As for the JSTL 1.1 JSP EL is assumed, a servlet container must at least meet the JSP 2.0 specification, so that it can be used on this. The reference implementation is divided into two JAR archives standard.jar and jstl.jar that must be commonly found in most containers only in the lib path of the Web application. To maintain backward compatibility, the JSTL 1.1 is " http://java.sun.com/jsp/jstl/fmt " referenced by the URI, while " http://java.sun.com/jstl/fmt " in JSTL 1.0 being used.

Example JSP page in XML notation ( JSPX ):

< jsp: root    xmlns: jsp = " http://java.sun.com/JSP/Page "    xmlns: c = " http://java.sun.com/jsp/jstl/core "    xmlns: fmt = " http://java.sun.com/jsp/jstl/fmt "    version = "2.0" >      JSTL 1.1 </ title> </ head> <body>   <h1> iteration < / h1 >   <ul>    <c:forEach var="num" begin="1" end="10">      <li> number <c:out value="${num}"/> </ li>    < / c: forEach > </ ul>   <h1> formatting < / h1 >   <p>    Currency: <fmt:formatNumber value="10000" type="currency" currencyCode="EUR" /> </ p>   </ body> </ html> < / jsp: root > Notes to the JSP code: </p> <p> The jsp: root element is the use of the base and the I18N taglibs (core and fmt ) from the JSTL displayed and they are bound to corresponding XML namespaces. Under the heading iteration, the forEach tag from the core library is used: the tag body (that is, the contents of the tag ) is ten times spent here. In this loop is found with $ { num } is a JSP expression: Here, with each loop, the current value of, num ' output. Under the heading formatting the formatNumber tag from the JSTL fmt library will be used. Depending on the language set ( this can be, for example, by fmt: setLocale set ) is the number 10000 here formatted differently ( For example, in German as " EUR 10,000.00 " and in English are output as " EUR 10,000.00 "). </p> <h2> The JSTL and Struts </h2> <p> In contrast to the Struts framework JSTL is not tied to a particular architecture paradigm, such as MVC. Both tag libraries have the same tags. Therefore, for the mixed use of the unique prefix (JSP ) or the namespace ( JSPX ) must be considered. </p> </section> <section class="relLinks"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- memim 1 wide adaptive --> <ins class="adsbygoogle" style="display:block;clear:both;" data-ad-client="ca-pub-8545452838648870" data-ad-slot="6796476374" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <a href="/specification-technical-standard.html">Specification (technical standard)</a> <a href="/uniform-resource-locator.html">Uniform Resource Locator</a> <a href="/javaserver-faces.html">JavaServer Faces</a> <a href="/software-framework.html">Software framework</a> <a href="/architectural-pattern.html">Architectural pattern</a> </section> <div class="comments"> </div> <section> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-8545452838648870" data-ad-slot="9697283175"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </section> <span style="font-size:.5em">432238</span> <div class="share_buttons"> <div class="addthis_sharing_toolbox"></div> </div> </main> </div> </td></tr><tr><td id="footer"> <div class="aligner"> <footer class="mainHolder" style="text-align:center;"> <!--LiveInternet counter--><script type="text/javascript"><!-- document.write("<a href='http://www.liveinternet.ru/click' "+ "target=_blank rel=nofollow><img src='//counter.yadro.ru/hit?t18.5;r"+ escape(document.referrer)+((typeof(screen)=="undefined")?"": ";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth? screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+ ";"+Math.random()+ "' alt='' title='LiveInternet' "+ "border='0' width='88' height='31'><\/a>") //--></script><!--/LiveInternet--> <br /> memim.com 2024<br /> All rights reserved<br /> <span style='font-size:0.5em'>Page generated in 0.0044<br /></span> <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5093bb6e1c1ddca0"></script> <script> function jr(ready){ if(window.jQuery){ //ready(); }else{ setTimeout(jr,100,ready); } } jr(function() { $(".imagesHolder img").each(function () { var i=$(this); console.log(i.attr('src')+' '+i.width()+' '+i.readyState); //$(this).remove(); }); }); </script> </footer> </div> </td></tr></table> <span style="font-size:.3em">de</span> </body> </html>