Package nl.gx.webmanager.taglib.sql
Class QueryTagSupport
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- javax.servlet.jsp.tagext.BodyTagSupport
-
- nl.gx.webmanager.taglib.sql.QueryTagSupport
-
- All Implemented Interfaces:
Serializable
,javax.servlet.jsp.jstl.sql.SQLExecutionTag
,javax.servlet.jsp.tagext.BodyTag
,javax.servlet.jsp.tagext.IterationTag
,javax.servlet.jsp.tagext.JspTag
,javax.servlet.jsp.tagext.Tag
,javax.servlet.jsp.tagext.TryCatchFinally
public abstract class QueryTagSupport extends javax.servlet.jsp.tagext.BodyTagSupport implements javax.servlet.jsp.tagext.TryCatchFinally, javax.servlet.jsp.jstl.sql.SQLExecutionTag
Tag handler for <Query> in JSTL.
- Author:
- Hans Bergsten, Justyna Horwat
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
myDataSourceSpecified
protected int
myMaxRows
protected boolean
myMaxRowsSpecified
protected Object
myRawDataSource
protected String
mySql
protected int
myStartRow
-
Constructor Summary
Constructors Constructor Description QueryTagSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 thesql
attribute or as the body, and save the result as a variable named by thevar
attribute in the scope specified by thescope
attribute, as an object that implements the Result interface.void
doFinally()
Close theConnection
, unless this action is used as part of a transaction.int
doStartTag()
Prepares for execution by setting the initial state, such as getting theConnection
.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.-
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
-
Methods inherited from class javax.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:
addSQLParameter
in interfacejavax.servlet.jsp.jstl.sql.SQLExecutionTag
-
doStartTag
public int doStartTag() throws javax.servlet.jsp.JspException
Prepares for execution by setting the initial state, such as getting theConnection
.- Specified by:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
-
doEndTag
public 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 thevar
attribute in the scope specified by thescope
attribute, as an object that implements the Result interface.The connection used to execute the statement comes either from the
DataSource
specified by thedataSource
attribute, provided by a parent action element, or is retrieved from a JSP scope attribute namedjavax.servlet.jstl.sql.dataSource
.- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
-
doCatch
public void doCatch(Throwable t) throws Throwable
Just rethrows the Throwable.- Specified by:
doCatch
in interfacejavax.servlet.jsp.tagext.TryCatchFinally
- Throws:
Throwable
-
doFinally
public void doFinally()
Close theConnection
, unless this action is used as part of a transaction.- Specified by:
doFinally
in interfacejavax.servlet.jsp.tagext.TryCatchFinally
-
-