Class QueryTagSupport
java.lang.Object
jakarta.servlet.jsp.tagext.TagSupport
jakarta.servlet.jsp.tagext.BodyTagSupport
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport
- All Implemented Interfaces:
SQLExecutionTag,BodyTag,IterationTag,JspTag,Tag,TryCatchFinally,Serializable
public abstract class QueryTagSupport
extends BodyTagSupport
implements TryCatchFinally, SQLExecutionTag
Tag handler for <Query> in JSTL.
- Author:
- Hans Bergsten, Justyna Horwat
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected intprotected booleanprotected Objectprotected Stringprotected intFields inherited from class jakarta.servlet.jsp.tagext.BodyTagSupport
bodyContentFields inherited from class jakarta.servlet.jsp.tagext.TagSupport
id, pageContextFields inherited from interface jakarta.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAGFields inherited from interface jakarta.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAINFields inherited from interface jakarta.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled by nested parameter elements to add PreparedStatement parameter values.voidJust rethrows the Throwable.intdoEndTag()Execute the SQL statement, set either through thesqlattribute or as the body, and save the result as a variable named by thevarattribute in the scope specified by thescopeattribute, as an object that implements the Result interface.voidClose theConnection, unless this action is used as part of a transaction.intPrepares for execution by setting the initial state, such as getting theConnectionvoidSetter method for the scope of the variable to hold the result.voidSetter method for the name of the variable to hold the result.Methods inherited from class jakarta.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContentMethods inherited from class jakarta.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
-
Field Details
-
rawDataSource
-
dataSourceSpecified
protected boolean dataSourceSpecified -
sql
-
maxRows
protected int maxRows -
maxRowsSpecified
protected boolean maxRowsSpecified -
startRow
protected int startRow
-
-
Constructor Details
-
QueryTagSupport
public QueryTagSupport()
-
-
Method Details
-
setVar
Setter method for the name of the variable to hold the result. -
setScope
Setter method for the scope of the variable to hold the result. -
addSQLParameter
Called by nested parameter elements to add PreparedStatement parameter values.- Specified by:
addSQLParameterin interfaceSQLExecutionTag- Parameters:
o- thePreparedStatementparameter value
-
doStartTag
Prepares for execution by setting the initial state, such as getting theConnection- Specified by:
doStartTagin interfaceTag- Overrides:
doStartTagin classBodyTagSupport- Returns:
- EVAL_BODY_BUFFERED
- Throws:
JspException- if an error occurred while processing this tag- See Also:
-
doEndTag
Execute the SQL statement, set either through the
sqlattribute or as the body, and save the result as a variable named by thevarattribute in the scope specified by thescopeattribute, as an object that implements the Result interface.The connection used to execute the statement comes either from the
DataSourcespecified by thedataSourceattribute, provided by a parent action element, or is retrieved from a JSP scope attribute namedjakarta.servlet.jstl.sql.dataSource.- Specified by:
doEndTagin interfaceTag- Overrides:
doEndTagin classBodyTagSupport- Returns:
- EVAL_PAGE
- Throws:
JspException- if an error occurred while processing this tag- See Also:
-
doCatch
Just rethrows the Throwable.- Specified by:
doCatchin interfaceTryCatchFinally- Parameters:
t- The throwable exception navigating through this tag.- Throws:
Throwable- if the exception is to be rethrown further up the nest chain.
-
doFinally
public void doFinally()Close theConnection, unless this action is used as part of a transaction.- Specified by:
doFinallyin interfaceTryCatchFinally
-