JSTL SQL Tags

In JSTL, SQL tags are used to access and manipulate various operations of database. It is responsible to interact the JSP page with any type of Database such as MySQL, Oracle, SQLite, etc. The below syntax is used to include SQL library within JSP: –

SQL Tags

These are some important JSTL SQL tags: –

  • <sql:setDataSource>: – This tag creates a DataSource to  communicate JSP with database server.
  • <sql:query>: – This tag executes the SQL query that is specified with it.
  • <sql:transaction>: – This tag performs various database action with single connection.
  • <sql:param>: – This tag provides parameter to SQL statement.
  • <sql:dateParam>:  – This tag provides date in the form of parameter to SQL statement.
  • <sql:update>: – This tag is used to update the value in database.

Example of JSTL SQL Tag

This is a simple example of JSTL SQL Tag that fetches data from MYSQL.

index.jsp

Output:

Leave a Comment