SQL Tags:
The tags are used to achieve common database related tasks such as selection, insertion, deletion, updation from within the jsp pages, without using any java code.
1). <sql:query>
This tag is used to query databases.
Syntax:
<sql:query sql="sqlQuery"
var="varName" [scope="{page|request|session|application}"]
[dataSource="dataSource"]
[maxRows="maxRows"]
[startRow="startRow"] />
var="varName" [scope="{page|request|session|application}"]
[dataSource="dataSource"]
[maxRows="maxRows"]
[startRow="startRow"] />
2). <sql:update>
This tag is used to execute SQL INSERT, UPDATE or DELETE statement. It is also used to execute Data Definition Language statements.
Syntax:
<sql:update sql="sqlUpdate"
[dataSource="dataSource"]
[var="varName"]
[scope={page|request|session|application}" ] />
[dataSource="dataSource"]
[var="varName"]
[scope={page|request|session|application}" ] />
3). <sql:setDataSource>
This tag is used to export a data source either as a scoped variable or as the data source configuration variable.
<sql: setDataSource
{dataSource="dataSource" | url = "jdbcUrl"
[driver="driverClassName"]
[user="userName"]
[password="password"]}
[var="varName"]
[scope="{page|request|session|application}"] />
{dataSource="dataSource" | url = "jdbcUrl"
[driver="driverClassName"]
[user="userName"]
[password="password"]}
[var="varName"]
[scope="{page|request|session|application}"] />
4). <sql:param>
This tag is used to set the values of parameter.
Syntax:
<sql:param value="value"/>
5). <sql:dateParam>
Sets the values of parameter markers in a SQL statement for values of type java.util.Date. It also works as a subtag of <sql:query> and <sql:update> tags.
Syntax:
<sql:dateParam value = "value" [type="{timestamp|time|date}"] />
6). <sql:transaction>
This tag is used to set a transaction context for <sql:query> and <sql:update> subtags.
Syntax:
<sql:transaction [dataSource="dataSource"]
[isolation=isolationLevel]>
<sql:query> and <sql:update> statements
</sql:transaction>
[isolation=isolationLevel]>
<sql:query> and <sql:update> statements
</sql:transaction>
isolationLevel ::= "read_committed"
| "read_uncommitted"
| "repeated_read"
| "serializable"
| "read_uncommitted"
| "repeated_read"
| "serializable"
0 Comments:
Post a Comment