Skip to Content

<p>h4. <b>Introduction :-</b>
</p>
JSP Standard Tag Library (JSTL) are set of standardized tags which developers can use across projects which involves Internationalization, Database manipulation XML processing etc. JSTL will speed up processing time  by more or less eliminating scripting elements which we use in a  raw .jsp file and by using this we can easily can fix errors.</p>
<p>In this first blog we will have a look on the various custom libraries of  JSTL. In  future blogs we  will focus on advanced concepts of JSTL.</p>
<p>h4. <b>JSTL Libraries :-</b>
</p>
<p>JSTL 1.0 specifies a set of custom tag libraries based on the JSP 1.2 version. There are four separate tag libraries, each containing custom actions targeting a specific functional area. This table lists each library with its recommended tag prefix and default URI: </p>

<p><head>
<meta http-equiv=Content-Type content=”text/html; charset=windows-1252″>
<meta name=ProgId content=Word.Document>
<meta name=Generator content=”Microsoft Word 10″>
<meta name=Originator content=”Microsoft Word 10″>
<link rel=File-List href=”Jstl_files/filelist.xml”>
<title>Description</title>
<!–[if gte mso 9]><xml>
<o:DocumentProperties>
  <o:Author>guruu</o:Author>
  <o:Template>Normal</o:Template>
  <o:LastAuthor>guruu</o:LastAuthor>
  <o:Revision>1</o:Revision>
  <o:TotalTime>1</o:TotalTime>
  <o:Created>2005-02-07T14:09:00Z</o:Created>
  <o:LastSaved>2005-02-07T14:10:00Z</o:LastSaved>
  <o:Pages>1</o:Pages>
  <o:Words>32</o:Words>
  <o:Characters>188</o:Characters>
  <o:Company>Wipro Technologies</o:Company>
  <o:Lines>1</o:Lines>
  <o:Paragraphs>1</o:Paragraphs>
  <o:CharactersWithSpaces>219</o:CharactersWithSpaces>
  <o:Version>10.4219</o:Version>
</o:DocumentProperties>
</xml><![endif]><![if gte mso 9]>

<!–

/* Style Definitions */

p.MsoNormal, li.MsoNormal, div.MsoNormal

     {mso-style-parent:””;

     margin:0in;

     margin-bottom:.0001pt;

     mso-pagination:widow-orphan;

     

     font-family:”Times New Roman”;

     mso-fareast-font-family:”Times New Roman”;}

span.SpellE

     {mso-style-name:””;

     mso-spl-e:yes;}

@page Section1

     

div.Section1

     

–>

</style>
<!–[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
     {mso-style-name:”Table Normal”;
     mso-tstyle-rowband-size:0;
     mso-tstyle-colband-size:0;
     mso-style-noshow:yes;
     mso-style-parent:””;
     mso-padding-alt:0in 5.4pt 0in 5.4pt;
     mso-para-margin:0in;
     mso-para-margin-bottom:.0001pt;
     mso-pagination:widow-orphan;
     font-size:10.0pt;
     font-family:”Times New Roman”;}
</style>
<![endif]–>
</head>

<body tab-interval:.5in’>

<div class=Section1>

<table class=MsoNormalTable border=1 cellpadding=0 style=’mso-cellspacing:1.5pt’>
<tr style=’mso-yfti-irow:0′>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal align=center style=’text-align:center’><b>
  style=’color:black’>Description</b></p>
  </td>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal align=center style=’text-align:center’><b>
  style=’color:black’>Prefix</b></p>
  </td>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal align=center style=’text-align:center’><b>
  style=’color:black’>Default URI</b></p>
  </td>
</tr>
<tr style=’mso-yfti-irow:1′>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> style=’color:black’>Core</p>
  </td>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> mso-bidi-
  color:#003366′>c style=’color:black’></p>
  </td>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> mso-bidi-
  color:#003366′>http://java.sun.com/jstl/core
  style=’color:black’></p>
  </td>
</tr>
<tr style=’mso-yfti-irow:2′>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> style=’color:black’>XML Processing</p>
  </td>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> mso-bidi-
  color:#003366′>x style=’color:black’></p>
  </td>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> mso-bidi-
  color:#003366′>http://java.sun.com/jstl/xml
  style=’color:black’></p>
  </td>
</tr>
<tr style=’mso-yfti-irow:3′>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> style=’color:black’>I18N & Formatting</p>
  </td>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> mso-bidi-
  color:#003366′>fmt style=’color:black’></p>
  </td>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> mso-bidi-
  color:#003366′>http://java.sun.com/jstl/fmt
  style=’color:black’></p>
  </td>
</tr>
<tr style=’mso-yfti-irow:4;mso-yfti-lastrow:yes’>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> style=’color:black’>Database Access</p>
  </td>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> 
  mso-bidi-color:#003366′>sql
  style=’color:black’></p>
  </td>
  <td style=’padding:.75pt .75pt .75pt .75pt’>
  <p class=MsoNormal> mso-bidi-
  color:#003366′>http://java.sun.com/jstl/sql
  style=’color:black’></p>
  </td>
</tr>
</table></p>

<p>The Core library contains actions for everyday tasks, such as including or excluding a piece of a page depending on a runtime condition, looping over a collection of items, manipulating URLs for session tracking.</p>
<p>The XML library contains actions for  XML processing, including parsing an XML document and transforming it using XSLT. It also provides actions for extracting pieces of a parsed XML document, looping over a set of nodes, and conditional processing based on node values.</p>
<p>Internationalization (i18n) and general formatting are supported by the actions in the I18N & Formatting library. </p>
<p>We can read and modify information stored in a database with the actions provided by the Database Access library. </p>
<p>Over time, we can expect all Web containers to include an implementation of the JSTL libraries, so no additional code will need to be installed. Until that happens, you can download and install the JSTL reference implementation (RI) instead. Installing it is easy: just copy all of the JAR files from the distribution’s lib directory to the WEB-INF/lib directory for your Web application. Note that JSTL 1.0 requires a JSP 1.2 container.</p>

<p>To use a JSTL library, whether it’s the implementation included with the container or the RI, we must declare the library using a taglib directive, just we would do for a regular custom tag library:</p>
<p><textarea rows=2 cols=70><%@ taglib prefix=”x” uri=”http://java.sun.com/jstl/xml” %></textarea></p>
<p>We should always use the default URI, even though the JSP specification allows you to override it. </p>
<p>h4. <b>Conclusion:- </b>
</p>
<p>Thus the above blog gives an overview on JSTL and various libraries associated with it. In the future blogs we will see some interesting functionalities of JSTL.</p>

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply