public abstract class QueryTagSupport extends BodyTagSupport implements TryCatchFinally, SQLExecutionTag
Tag handler for <Query> in JSTL.
Modifier and Type | Field and Description |
---|---|
protected boolean |
dataSourceSpecified |
protected int |
maxRows |
protected boolean |
maxRowsSpecified |
protected Object |
rawDataSource |
protected String |
sql |
protected int |
startRow |
bodyContent
id, pageContext
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
EVAL_BODY_AGAIN
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
Constructor and Description |
---|
QueryTagSupport() |
Modifier and Type | Method and Description |
---|---|
void |
addSQLParameter(Object o)
Called by nested parameter elements to add PreparedStatement
parameter values.
|
void |
doCatch(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 |
void |
setScope(String scopeName)
Setter method for the scope of the variable to hold the
result.
|
void |
setVar(String var)
Setter method for the name of the variable to hold the
result.
|
doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getParent, setPageContext, setParent
protected Object rawDataSource
protected boolean dataSourceSpecified
protected String sql
protected int maxRows
protected boolean maxRowsSpecified
protected int startRow
public void setVar(String var)
public void setScope(String scopeName)
public void addSQLParameter(Object o)
addSQLParameter
in interface SQLExecutionTag
o
- the PreparedStatement
parameter valuepublic int doStartTag() throws JspException
Connection
doStartTag
in interface Tag
doStartTag
in class BodyTagSupport
JspException
- if an error occurred while processing this tagTag.doStartTag()
public int doEndTag() throws 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 Tag
doEndTag
in class BodyTagSupport
JspException
- if an error occurred while processing this tagTag.doEndTag()
public void doCatch(Throwable t) throws Throwable
doCatch
in interface TryCatchFinally
t
- The throwable exception navigating through this tag.Throwable
- if the exception is to be rethrown further up
the nest chain.public void doFinally()
Connection
, unless this action is used
as part of a transaction.doFinally
in interface TryCatchFinally
Copyright © 2016 JBoss by Red Hat. All rights reserved.