Summary of common SQL tag usage for operating databases in JSP, jspsql
<SQL: setDataSource>
Tag Data Source
Syntax structure:
Copy codeThe Code is as follows:
<SQL: setDataSource url = "jdbcUrl" driver = "driverClassName" user = "userName" password = "password" [var = "varName"] [scope = "{page | request | session | application} "]/>
<SQL: update>
Add, delete, and modify tags
The first format:
Copy codeThe Code is as follows:
<SQL: update SQL = "sqlUpdate" [var = "varName"] [scope = "{page | request | session | application}"] [dataSource = "dataSource"]/>
Eg:
<% @ Page contentType = "text/html; charset = GBK" %> <% @ taglib uri =" http://java.sun.com/jsp/jstl/sql "Prefix =" SQL "%> <% @ taglib uri =" http://java.sun.com/jsp/jstl/core "Prefix =" c "%> <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
The second format is to use SQL statements as the body content.
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %> <% @ taglib uri = "http://java.sun.com/jsp/jstl/ SQL" prefix = "SQL" %> <! DOCTYPE html>
<SQL: query> tag
Used to query data in a database
The first format:
Copy codeThe Code is as follows:
<SQL: query SQL = "sqlQuery" [var = "varName"] [scope = "{page | request | session | application}"] [dataSource = "dataSource"] maxRows = "" startRow = "startRow"/>
The second format is to use SQL statements as the body content.
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %> <% @ taglib uri =" http://java.sun.com/jsp/jstl/sql "Prefix =" SQL "%> <% @ taglib uri =" http://java.sun.com/jsp/jstl/core "Prefix =" c "%> <! DOCTYPE html>
<SQL: param> label and <SQL: dateParam> label
<SQL: param> two formats are available:
The format without body content is
<sql:param value="value" />
The body content format is
<SQL: param> body content </SQL: param>
<SQL: dateParam> label format:
<sql:dateParam value="value" [type="{timestamp|time|date}"] />
Use the <SQL: dateParam> label if the parameter is related to the time and date.
<SQL: transaction> label
Provides a security mechanism (Transaction Processing Security Mechanism) for database access)
Format:
<sql:transaction [dataSource="dataSource"] [isolation="read_committed|read_uncomited|repeatabl_read|serializable"]><sql:update> or <sql:query></sql:transaction>
Articles you may be interested in:
- Jsp obtains data from the database filling drop-down box to implement the two-level linkage menu
- Example of SQL Server 2008 database access using JDBC in JSP
- Java Implementation of JSP connection to Oracle Database in Servelt
- Analysis on paging technology for jsp database reading
- Jsp reads database connection parameters from web. xml
- JSP connection MySql/ms SQL Server/Oracle Database Connection Methods [finishing]
- Jsp connection to the Access Database (do not create an ODBC Data Source)
- JSP connection to Access database
- Using asp or jsp, how does flash read and display all records in a table in the database?
- Pagination of JSP database operation data
- Access the Oracle database in JSP
- How to access MySQL Database Using JSP
- How to Use the PreparedStatement object in JSP to operate databases