public abstract class QueryTagSupport extends javax.servlet.jsp.tagext.BodyTagSupport implements javax.servlet.jsp.tagext.TryCatchFinally, SQLExecutionTag
Tag handler for <Query> in JSTL.
| Modifier and Type | Field and Description |
|---|---|
private java.sql.Connection |
conn |
protected boolean |
dataSourceSpecified |
private boolean |
isPartOfTransaction |
protected int |
maxRows |
protected boolean |
maxRowsSpecified |
private java.util.List |
parameters |
protected java.lang.Object |
rawDataSource |
private int |
scope |
protected java.lang.String |
sql |
protected int |
startRow |
private java.lang.String |
var |
| Constructor and Description |
|---|
QueryTagSupport() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSQLParameter(java.lang.Object o)
Called by nested parameter elements to add PreparedStatement
parameter values.
|
void |
doCatch(java.lang.Throwable t)
Just rethrows the Throwable.
|
int |
doEndTag()
Execute the SQL statement, set either through the
sql
attribute or as the body, and save the result as a variable
named by the var attribute in the scope specified
by the scope attribute, as an object that implements
the Result interface. |
void |
doFinally()
Close the
Connection, unless this action is used
as part of a transaction. |
int |
doStartTag()
Prepares for execution by setting the initial state, such as
getting the
Connection |
private java.sql.Connection |
getConnection() |
private void |
init() |
private void |
setParameters(java.sql.PreparedStatement ps,
java.util.List parameters) |
void |
setScope(java.lang.String scopeName)
Setter method for the scope of the variable to hold the
result.
|
void |
setVar(java.lang.String var)
Setter method for the name of the variable to hold the
result.
|
doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContentfindAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValueprivate java.lang.String var
private int scope
protected java.lang.Object rawDataSource
protected boolean dataSourceSpecified
protected java.lang.String sql
protected int maxRows
protected boolean maxRowsSpecified
protected int startRow
private java.sql.Connection conn
private java.util.List parameters
private boolean isPartOfTransaction
private void init()
public void setVar(java.lang.String var)
public void setScope(java.lang.String scopeName)
public void addSQLParameter(java.lang.Object o)
addSQLParameter in interface SQLExecutionTago - the PreparedStatement parameter valuepublic int doStartTag()
throws javax.servlet.jsp.JspException
ConnectiondoStartTag in interface javax.servlet.jsp.tagext.TagdoStartTag in class javax.servlet.jsp.tagext.BodyTagSupportjavax.servlet.jsp.JspExceptionpublic int doEndTag()
throws javax.servlet.jsp.JspException
Execute the SQL statement, set either through the sql
attribute or as the body, and save the result as a variable
named by the var attribute in the scope specified
by the scope attribute, as an object that implements
the Result interface.
The connection used to execute the statement comes either
from the DataSource specified by the
dataSource attribute, provided by a parent action
element, or is retrieved from a JSP scope attribute
named javax.servlet.jstl.sql.dataSource.
doEndTag in interface javax.servlet.jsp.tagext.TagdoEndTag in class javax.servlet.jsp.tagext.BodyTagSupportjavax.servlet.jsp.JspExceptionpublic void doCatch(java.lang.Throwable t)
throws java.lang.Throwable
doCatch in interface javax.servlet.jsp.tagext.TryCatchFinallyjava.lang.Throwablepublic void doFinally()
Connection, unless this action is used
as part of a transaction.doFinally in interface javax.servlet.jsp.tagext.TryCatchFinallyprivate java.sql.Connection getConnection()
throws javax.servlet.jsp.JspException,
java.sql.SQLException
javax.servlet.jsp.JspExceptionjava.sql.SQLExceptionprivate void setParameters(java.sql.PreparedStatement ps,
java.util.List parameters)
throws java.sql.SQLException
java.sql.SQLException