1.0
1.2
xdbtags
http://java.sun.com/jstl/xml
Database Tags
A set of tags for working with SQL database access
connect
xdb.Connect
empty
Use to open a connection to a database. Other tags
in this library will operate on the opened connection.
(You could have several open connection, if you specify
id's for the extra connections.) Note that connections
are represented by objects of type sdb.ConnectionInfo.
An object of this type is stored as an attribute on
the page, session, request, or application scope object.
Typical usage will likely include host, username,
password, and database attributes.
driver
false
true
Can be given by a run-time expression.
The class name of the JDBC driver that should be used.
Default is "org.gjt.mm.mysql.Driver", for accessing a
MySQL database.
dbtype
false
true
Can be given by a run-time expression.
Database type, "mysql" by default. (This is the name
used in the JDBC URI, "jdbc:mysql://...")
host
false
true
Can be given by a run-time expression.
Host name of the computer where database is located.
Default is "localhost".
username
false
true
Can be given by a run-time expression.
Username for logging onto the database.
Default is "root".
password
false
true
Can be given by a run-time expression.
Password for logging onto the database.
Default is the empty string.
database
false
true
Can be given by a run-time expression.
The name of the database that will be used for
the SQL commands. Default is no database specified.
id
false
If present, gives the attribute name under which the
connection object is stored. Default is
"__xdbtags_connection_object__". If you use a different
id here, you must use the same id in any tags that
manipulate the connection.
scope
false
Should be one of "page", "request", "session", or "application".
Default is "page". Specifies the scope where the connection
object is stored.
close
xdb.Close
empty
Closes the connection.
id
false
If present, gives the attribute name under which the
connection object was stored. Default is
"__xdbtags_connection_object__".
iferror
xdb.IfError
JSP
Use after opening or otherwise using a connection.
If the most recent database operation produced an
error, the body of the tag is evaluated. Otherwise,
it is skipped.
id
false
If present, gives the attribute name under which the
connection object was stored. Default is
"__xdbtags_connection_object__".
ifnoerror
xdb.IfNoError
JSP
Use after opening or otherwise using a connection.
If the most recent database operation produced an
error, the body of the tag is skipped. Otherwise,
it is evaluated.
scope
false
If present, gives the attribute name under which the
connection object was stored. Default is
"__xdbtags_connection_object__".
errormessage
xdb.ErrorMessage
empty
Use after opening or otherwise using a connection.
If the most recent database operation produced an
error, the error message is output to the page. If
there was no error, no output is produced.
id
false
If present, gives the attribute name under which the
connection object was stored. Default is
"__xdbtags_connection_object__".
update
xdb.DoUpdate
empty
Perform an executeUpdate on a database connection.
command
true
true
Gives the SQL update command to be executed.
Can be given by a run-time expression.
id
false
If present, gives the attribute name under which the
connection object was stored. Default is
"__xdbtags_connection_object__".
query
xdb.DoQuery
JSP
Perform an exectueQuery on a database connection.
Iterates its body over the rows of the result set
(or skips its body if there is an error). In the
body use "get" tags to access the data in the current
row.
command
true
true
Gives the SQL query command to be executed.
Can be given by a run-time expression.
id
false
If present, gives the attribute name under which the
connection object was stored. Default is
"__xdbtags_connection_object__".
get
xdb.DoGet
empty
Get a value from the current row of a result set,
and output it to the page.
Only for use inside the body of a query tag.
column
true
true
The number or name of the column to be retrieved.
htmlencode
no
If set to "no" or "false", the data from the
column
id
false
If present, gives the attribute name under which the
connection object was stored. Default is
"__xdbtags_connection_object__".
table
xdb.Table
empty
Makes a nice centered table with data returned by an SQL query.
command
true
true
Gives the SQL query command to be executed.
Can be given by a run-time expression.
id
false
If present, gives the attribute name under which the
connection object was stored. Default is
"__xdbtags_connection_object__".