org.apache.taglibs.dbtags.statement
Class StatementImplTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.apache.taglibs.dbtags.statement.StatementImplTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag, StatementTag

public class StatementImplTag
extends javax.servlet.jsp.tagext.BodyTagSupport
implements StatementTag

JSP tag statement. According to the TEI, the java.sql.Statement object specified in the "id" attribute is available within the scope of the statement tags.

JSP Tag Lib Descriptor

 <name>statement</name>
 <tagclass>org.apache.taglibs.dbtags.statement.StatementImplTag</tagclass>
 <teiclass>org.apache.taglibs.dbtags.connection.StatementTEI</teiclass>
 <bodycontent>JSP</bodycontent>
 <info>JSP tag statement, uses the enclosed query and resultset/execute
 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

Field Summary
 
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
 
Constructor Summary
StatementImplTag()
           
 
Method Summary
protected  java.sql.Statement createStatement(java.sql.Connection theConnection)
          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.
 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
 

Constructor Detail

StatementImplTag

public StatementImplTag()
Method Detail

setQuery

public void setQuery(java.lang.String query)
Description copied from interface: StatementTag
SQL query to be executed in the statement

Specified by:
setQuery in interface StatementTag
Parameters:
query - SQL query

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 - id of the Connection attribute
See Also:
ConnectionTag

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
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspTagException

createStatement

protected java.sql.Statement createStatement(java.sql.Connection theConnection)
                                      throws java.sql.SQLException
Let subclass redefine how to create the statement

Throws:
java.sql.SQLException

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()
Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport

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.