Summary of common SQL tag usage for operating databases in JSP, jspsql

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.