org.apache.taglibs.dbtags.preparedstatement
Class PreparedStatementImplTag
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.apache.taglibs.dbtags.preparedstatement.PreparedStatementImplTag
- All Implemented Interfaces:
- javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, StatementTag, javax.servlet.jsp.tagext.Tag
- public class PreparedStatementImplTag
- extends javax.servlet.jsp.tagext.BodyTagSupport
- implements StatementTag
JSP tag preparedstatement. According to the TEI, the preparedstatemnt
object specified in the "id" attribute is available within the scope
of the preparedstatement tags. However, this is not quite the case.
Technically, the object is not added to the page context until after
the query tag is executed, because PreparedStatement objects cannot
be instantiated without a query.
JSP Tag Lib Descriptor
<name>preparedStatement</name>
<tagclass>org.apache.taglibs.dbtags.preparedstatement.PreparedStatementImplTag</tagclass>
<teiclass>org.apache.taglibs.dbtags.connection.PreparedStatementTEI</teiclass>
<bodycontent>JSP</bodycontent>
<info>JSP tag preparedstatement, used the enclosed query,
resultset/execute and set* tags to perform a database operation.</info>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>conn</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</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 |
protected java.sql.PreparedStatement |
createStatement(java.sql.Connection theConnection,
java.lang.String theQuery)
Let subclass redefine how to create the statement |
int |
doAfterBody()
|
int |
doEndTag()
|
int |
doStartTag()
|
java.sql.ResultSet |
executeQuery()
Execute a SQL select |
void |
executeUpdate()
Execute a SQL insert, update or delete. |
java.sql.PreparedStatement |
getPreparedStatement()
Get the PreparedStatement contained within this tag |
void |
release()
|
void |
setConn(java.lang.String connId)
The id of a page context attribute containing a java.sql.Connection |
void |
setQuery(java.lang.String query)
SQL query to be executed in the statement |
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 |
PreparedStatementImplTag
public PreparedStatementImplTag()
setQuery
public void setQuery(java.lang.String query)
throws java.sql.SQLException,
javax.servlet.jsp.JspTagException
- Description copied from interface:
StatementTag
- SQL query to be executed in the statement
- Specified by:
setQuery
in interface StatementTag
- Parameters:
query
- SQL query
- Throws:
java.sql.SQLException
- throws an exception when a PreparedStatement cannot be created
javax.servlet.jsp.JspTagException
createStatement
protected java.sql.PreparedStatement createStatement(java.sql.Connection theConnection,
java.lang.String theQuery)
throws java.sql.SQLException
- Let subclass redefine how to create the statement
- Throws:
java.sql.SQLException
setConn
public void setConn(java.lang.String connId)
- Description copied from interface:
StatementTag
- The id of a page context attribute containing a java.sql.Connection
- Specified by:
setConn
in interface StatementTag
- Parameters:
connId
- - See Also:
ConnectionTag
getPreparedStatement
public java.sql.PreparedStatement getPreparedStatement()
- Get the PreparedStatement contained within this tag
- Returns:
- the PreparedStatement
executeUpdate
public void executeUpdate()
throws java.sql.SQLException
- Description copied from interface:
StatementTag
- Execute a SQL insert, update or delete.
- Specified by:
executeUpdate
in interface StatementTag
- Throws:
java.sql.SQLException
executeQuery
public java.sql.ResultSet executeQuery()
throws java.sql.SQLException
- Description copied from interface:
StatementTag
- Execute a SQL select
- Specified by:
executeQuery
in interface StatementTag
- Returns:
- Resultset based on the
query
- Throws:
java.sql.SQLException
doStartTag
public int doStartTag()
throws javax.servlet.jsp.JspTagException
- Specified by:
doStartTag
in interface javax.servlet.jsp.tagext.Tag
- Throws:
javax.servlet.jsp.JspTagException
doAfterBody
public int doAfterBody()
throws javax.servlet.jsp.JspTagException
- Specified by:
doAfterBody
in interface javax.servlet.jsp.tagext.IterationTag
- Throws:
javax.servlet.jsp.JspTagException
doEndTag
public int doEndTag()
- Specified by:
doEndTag
in interface javax.servlet.jsp.tagext.Tag
release
public void release()
- Specified by:
release
in interface javax.servlet.jsp.tagext.Tag
Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.