Common SQL Tag Usage Summary _jsp programming for manipulating databases in JSP

Source: Internet
Author: User
Tags time and date

<sql:setDataSource>
Label Settings Data source

Syntax structure:

Copy Code code as follows:

<sql:setdatasource url= "Jdbcurl" driver= "Driverclassname" user= "userName" password= "password" [var = "VarName"] [ Scope= "{Page | request | session | application}"]/>


<sql:update>
tags to delete and modify the operation

First form:

Copy Code code 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" 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 ontology content

<% @page language= "java" contenttype= "text/html;charset=gb2312"%> <%@ taglib uri=
"http://java.sun.com/ Jsp/jstl/sql "prefix=" SQL%>
<! DOCTYPE html>
 
 



<sql:query> Label
used to query data in a database
First form:

Copy Code code 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 ontology 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> tags and <sql:dateParam> labels
there are two forms of <sql:param>: With ontology content and without ontology content

The format without ontology content is

<sql:param value= "Value"/>

The format with ontology content is

<sql:param>

Ontology Content

</sql:param>

The format of the <sql:dateParam> label is:

<sql:dateparam value= "Value" [type= ' {timestamp|time|date} ']/>

Use <sql:dateParam> label if parameters are related to time and date


<sql:transaction> Label
provides a security mechanism for accessing a database (the security mechanism for handling things)

The format is:

<sql:transaction [datasource= "DataSource"] [isolation=] read_committed|read_uncomited|repeatabl_read| Serializable "]>

<sql:update> or <sql:query>

</sql:transaction>

 

Related Article

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.