Class QueryTag
java.lang.Object
jakarta.servlet.jsp.tagext.TagSupport
jakarta.servlet.jsp.tagext.BodyTagSupport
com.invirgance.convirgance.web.tag.QueryTag
- All Implemented Interfaces:
jakarta.servlet.jsp.tagext.BodyTag,jakarta.servlet.jsp.tagext.IterationTag,jakarta.servlet.jsp.tagext.JspTag,jakarta.servlet.jsp.tagext.Tag,Serializable
public class QueryTag
extends jakarta.servlet.jsp.tagext.BodyTagSupport
A custom JSP tag that executes a database query and stores the result in a variable.
This tag processes its body content as an SQL query and executes it against a database
specified by a JNDI data source name. The query results are stored in the specified
variable and scope.
- Author:
- jbanes
- See Also:
-
Field Summary
Fields 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 TypeMethodDescriptionintExecutes the SQL query contained in the tag body after the body has been evaluated.com.invirgance.convirgance.json.JSONObjectGets the binding object for SQL parameters.getJndi()Gets the JDNI name.getScope()The scope this is accessible in.getVar()The variable this is assigned to.voidsetBinding(com.invirgance.convirgance.json.JSONObject binding) Sets the binding object to use for SQL query parameters.voidSets the connection name to use.voidSets the scope this can be accessed from.voidSets the variable this is assigned to.Methods inherited from class jakarta.servlet.jsp.tagext.BodyTagSupport
doEndTag, doInitBody, doStartTag, 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
-
Constructor Details
-
QueryTag
public QueryTag()
-
-
Method Details
-
getVar
The variable this is assigned to.- Returns:
- The name.
-
setVar
Sets the variable this is assigned to.- Parameters:
variable- The name.
-
getScope
The scope this is accessible in.- Returns:
- The scope.
-
setScope
Sets the scope this can be accessed from.- Parameters:
scope- The scope.
-
getJndi
Gets the JDNI name.- Returns:
- The name.
-
setJndi
Sets the connection name to use.- Parameters:
jndi- The connection name.
-
getBinding
public com.invirgance.convirgance.json.JSONObject getBinding()Gets the binding object for SQL parameters.- Returns:
- The bindings object
-
setBinding
public void setBinding(com.invirgance.convirgance.json.JSONObject binding) Sets the binding object to use for SQL query parameters. When provided, these bindings are used for parameter substitution in the SQL query.- Parameters:
binding- The binding object
-
doAfterBody
public int doAfterBody() throws jakarta.servlet.jsp.JspExceptionExecutes the SQL query contained in the tag body after the body has been evaluated. The query results are stored in the specified variable.- Specified by:
doAfterBodyin interfacejakarta.servlet.jsp.tagext.IterationTag- Overrides:
doAfterBodyin classjakarta.servlet.jsp.tagext.BodyTagSupport- Returns:
- SKIP_BODY to skip further body evaluation
- Throws:
jakarta.servlet.jsp.JspException- If a database error occurs
-