JSTL useful tags tutorial

The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which facilitates iteration and control statements,internationalization,sql and xml tags.
JSTL.

Types of JSTL tags

  1. Core Tags:-It facilitates most commonly used operations like iteration,control statments,exception handling etc.To use Core Tags you need to include following tag library uri to the jsp page.
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  2. Formatting and Localization Tags:These tags can be used to format a number,text or date and also provide i18n feature..To use Formatting and Localization Tags you need to include following tag library uri to the jsp page.
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    
  3. SQL tags:It provides support for interaction with relational databases such as Oracle, MySql etc.
    To use SQL tags you need to include following tag library uri to the jsp page.

    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql " %>
    
  4. XML tags:It has custom tags for interacting with XML data.To useĀ  XML tags you need to include following tag library uri to the jsp page.
    <%@ taglib prefix="xml" uri="http://java.sun.com/jsp/jstl/xml" %>
    
  5. Functions tags:These tags provide a number of functions that can be used to perform common operation, like String Concatenation, Split String etc.To useĀ  XML tags you need to include following tag library uri to the jsp page.
    <%@ taglib prefix="xml" uri="http://java.sun.com/jsp/jstl/functions"%>
     

JSTL Core tags

First you need to add above mentioned taglib uri for JSTL core tags.There are following JSTL core tags.

  1. <c:out>
  2. <c:forEach>
  3. <c:if>
  4. <c:set>
  5. <c:redirect>
  6. <c:choose>
  7. <c:import>

Leave a Reply