JSTL sql Tag Library

JSTL sql Tag Library


Posted in : Java Posted on : April 20, 2012 at 7:30 PM Comments : [ 0 ]

In this tutorial you will learn about the JSTL sql tag library.

JSTL sql Tag Library

In this tutorial you will learn about the JSTL sql tag library.

JSTL sql tag library provides various tags to access the database. These tags are designed in such a way that are helpful in quick prototyping and for the simple applications. In general when applications are developed for the production, database operations are encapsulated in JavaBeans components.

To use these tags in JSP one should have use the following taglib :

<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

Above written taglib is a standard syntax for using the JSTL sql tag library.

Tags of JSTL sql tag library can be classified on the basis on their functional area these are as follows :

Function Tags
  setDataSource
SQL query, dateParam, param,
transaction, update

The table above describes that each tag is used for fulfilling the different purposes i.e they are defined as according to their function area such as :

  • setDataSource : This tag is used for creating a DataSource which is only suitable for prototyping.
  • query : This tag is used for executing the SQL query written into its body or through the sql attribute.
  • dateParam : This tag is used for giving a specified java.util.Date value as a parameter in a SQL statement.
  • param : This tag is used for giving a specified value as a parameter in a SQL statement.
  • transaction : This tag is used to execute all the statements within a transaction.
  • update : This tag is used for executing the SQL update written into its body or through the sql attribute.

NOTE : Before creating an example following things are need to be known in advance. Since we have to deal with the database so at first we will required a database package to manipulate with the data. Here I will use MySQL so in all of the examples I will use the databases related terms in perspective of MySQL.

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics