org.apache.taglibs.dbtags.connection
Class ConnectionTag
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.apache.taglibs.dbtags.connection.ConnectionTag
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag
public class ConnectionTag
- extends javax.servlet.jsp.tagext.BodyTagSupport
JSP tag connection, used to get a
java.sql.Connection object from the DriverManager.
JSP Tag Lib Descriptor
<name>connection</name>
<tagclass>org.apache.taglibs.dbtags.connection.ConnectionTag</tagclass>
<bodycontent>JSP</bodycontent>
<teiclass>org.apache.taglibs.dbtags.connection.ConnectionTEI</teiclass>
<info>Opens a connection based on either a url in the body of the tag
or by using the "datasource" tag attribute to reference to a
javax.sql.DataSource page attribute. driver (optional),
userid (optional), and password (optional) are also set in the
body of the tag.</info>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>jndiName</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>dataSource
<required>false
<rtexprvalue>false
</attribute>
- Author:
- Morgan Delagrange
- See Also:
- Serialized Form
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
bodyContent |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
id, pageContext |
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag |
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
EVAL_BODY_AGAIN |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Method Summary |
int |
doAfterBody()
|
int |
doEndTag()
|
int |
doStartTag()
|
void |
release()
|
void |
setDataSource(java.lang.String dataSourceName)
Set the name of a javax.sql.DataSource page attribute
which can create a database connection |
void |
setDriver(java.lang.String driver)
java.sql.Driver for the database. |
void |
setJndiName(java.lang.String jndiName)
jndi named datasource used for connecting to the database via a jndi lookup |
void |
setPassword(java.lang.String password)
Password for the database. |
void |
setUrl(java.lang.String url)
URL of the database to access. |
void |
setUserId(java.lang.String userId)
User id for the database. |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
doInitBody, getBodyContent, getPreviousOut, setBodyContent |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.jsp.tagext.Tag |
getParent, setPageContext, setParent |
ConnectionTag
public ConnectionTag()
setDataSource
public void setDataSource(java.lang.String dataSourceName)
- Set the name of a javax.sql.DataSource page attribute
which can create a database connection
- Parameters:
dataSourceName
- name of a javax.sql.DataSource page attribute
setUrl
public void setUrl(java.lang.String url)
- URL of the database to access.
- Parameters:
url
- database URL
setDriver
public void setDriver(java.lang.String driver)
- java.sql.Driver for the database. This method is
optional if you have already loaded the Driver in
the JVM.
- Parameters:
driver
- class name of the java.sql.Driver
setJndiName
public void setJndiName(java.lang.String jndiName)
- jndi named datasource used for connecting to the database via a jndi lookup
- Parameters:
jndiName
- jndi name for the jdbc datasourcer
setUserId
public void setUserId(java.lang.String userId)
- User id for the database. Optional if the user id
is already encoded in the URL, or if it is not
required by the database.
- Parameters:
userId
- user id for the database.
setPassword
public void setPassword(java.lang.String password)
- Password for the database. Optional if the
password is already encoded in the URL, or if
it is not required by the database.
- Parameters:
password
- password for the given user id
doStartTag
public int doStartTag()
throws javax.servlet.jsp.JspTagException
- Specified by:
doStartTag
in interface javax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in class javax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspTagException
doAfterBody
public int doAfterBody()
throws javax.servlet.jsp.JspTagException
- Specified by:
doAfterBody
in interface javax.servlet.jsp.tagext.IterationTag
- Overrides:
doAfterBody
in class javax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspTagException
doEndTag
public int doEndTag()
throws javax.servlet.jsp.JspTagException
- Specified by:
doEndTag
in interface javax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in class javax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspTagException
release
public void release()
- Specified by:
release
in interface javax.servlet.jsp.tagext.Tag
- Overrides:
release
in class javax.servlet.jsp.tagext.BodyTagSupport
Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.