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:
jakarta.servlet.jsp.jstl.sql.SQLExecutionTag,jakarta.servlet.jsp.tagext.BodyTag,jakarta.servlet.jsp.tagext.IterationTag,jakarta.servlet.jsp.tagext.JspTag,jakarta.servlet.jsp.tagext.Tag,jakarta.servlet.jsp.tagext.TryCatchFinally,Serializable
public abstract class QueryTagSupport extends jakarta.servlet.jsp.tagext.BodyTagSupport implements jakarta.servlet.jsp.tagext.TryCatchFinally, jakarta.servlet.jsp.jstl.sql.SQLExecutionTagTag handler for <Query> in JSTL.
- Author:
- Hans Bergsten, Justyna Horwat
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleandataSourceSpecifiedprotected intmaxRowsprotected booleanmaxRowsSpecifiedprotected ObjectrawDataSourceprotected Stringsqlprotected intstartRow
-
Constructor Summary
Constructors Constructor Description QueryTagSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSQLParameter(Object o)Called by nested parameter elements to add PreparedStatement parameter values.voiddoCatch(Throwable t)Just 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.voiddoFinally()Close theConnection, unless this action is used as part of a transaction.intdoStartTag()Prepares for execution by setting the initial state, such as getting theConnectionvoidsetScope(String scopeName)Setter method for the scope of the variable to hold the result.voidsetVar(String var)Setter 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, setBodyContent
-
Methods inherited from class jakarta.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
-
-
-
-
Method Detail
-
setVar
public void setVar(String var)
Setter method for the name of the variable to hold the result.
-
setScope
public void setScope(String scopeName)
Setter method for the scope of the variable to hold the result.
-
addSQLParameter
public void addSQLParameter(Object o)
Called by nested parameter elements to add PreparedStatement parameter values.- Specified by:
addSQLParameterin interfacejakarta.servlet.jsp.jstl.sql.SQLExecutionTag
-
doStartTag
public int doStartTag() throws jakarta.servlet.jsp.JspExceptionPrepares for execution by setting the initial state, such as getting theConnection- Specified by:
doStartTagin interfacejakarta.servlet.jsp.tagext.Tag- Overrides:
doStartTagin classjakarta.servlet.jsp.tagext.BodyTagSupport- Throws:
jakarta.servlet.jsp.JspException
-
doEndTag
public int doEndTag() throws jakarta.servlet.jsp.JspExceptionExecute 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 interfacejakarta.servlet.jsp.tagext.Tag- Overrides:
doEndTagin classjakarta.servlet.jsp.tagext.BodyTagSupport- Throws:
jakarta.servlet.jsp.JspException
-
doCatch
public void doCatch(Throwable t) throws Throwable
Just rethrows the Throwable.- Specified by:
doCatchin interfacejakarta.servlet.jsp.tagext.TryCatchFinally- Throws:
Throwable
-
doFinally
public void doFinally()
Close theConnection, unless this action is used as part of a transaction.- Specified by:
doFinallyin interfacejakarta.servlet.jsp.tagext.TryCatchFinally
-
-