Java Server Pages Standard Tag Library (JSTL)
Along with JSP technology, Sun offered a standard tag library called JavaServerPages Standard Tag Library (JSTL). In the previous article on custom tags, we have gone through the advantages of using custom tags. This tag library provides all those standard tags that will lead to any kind of javascript in the JSP. This tag library also covers conditionals, iterators, XML document manipulation tags, internationalization and DB access tags. These tags are grouped in following categories
- Core
- XML
- Internationalization
- SQL
- Function
Using JSTL:
This tag library can be used in the same way as any other custom tag library. Jsp using this custom tag will look like this.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Custom Tag Example</title>
</head>
<jsp:useBean id="customer" scope="page" class="com.myorg.jsptutorial.Customer"></jsp:useBean>
<body>
<h1><c:out value="${customer.name}"/></h1>
</body>
</html>
First, we are using the taglib directive to declare the tag library. Next is the prefix=”c”, this is used to make a call to the tag library through tag <c:out…./>. This tag just prints value of the customer object’s name attribute. It calls getName() method on this object.
Now let us look at the details of each of the above tag library.
Core:
- Uri – http://java.sun.com/jsp/jstl/core
- Prefix – c
- Used for variable support, flow control, url management, etc.
XML:
- Uri – http://java.sun.com/jsp/jstl/xml
- Prefix – x
- Used for core, flow control and transformation of xml
Internationalization:
- Uri – http://java.sun.com/jsp/jstl/fmt
- Prefix – fmt
- Used for internationalization tasks like locale, message formatting, number and date formatting.
SQL:
- Uri – http://java.sun.com/jsp/jstl/sql
- Prefix – sql
- Used for database interaction related tags.
Function:
- Uri – http://java.sun.com/jsp/jstl/functions
- Prefix – fn
-
Used for few functions on collection and string.









please provide more information on JSP and J2ME.
Leave your response!