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

    bodyContent

    Fields inherited from class jakarta.servlet.jsp.tagext.TagSupport

    id, pageContext

    Fields inherited from interface jakarta.servlet.jsp.tagext.BodyTag

    EVAL_BODY_BUFFERED, EVAL_BODY_TAG

    Fields inherited from interface jakarta.servlet.jsp.tagext.IterationTag

    EVAL_BODY_AGAIN

    Fields inherited from interface jakarta.servlet.jsp.tagext.Tag

    EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Executes the SQL query contained in the tag body after the body has been evaluated.
    com.invirgance.convirgance.json.JSONObject
    Gets the binding object for SQL parameters.
    Gets the JDNI name.
    The scope this is accessible in.
    The variable this is assigned to.
    void
    setBinding(com.invirgance.convirgance.json.JSONObject binding)
    Sets the binding object to use for SQL query parameters.
    void
    Sets the connection name to use.
    void
    Sets the scope this can be accessed from.
    void
    setVar(String variable)
    Sets the variable this is assigned to.

    Methods inherited from class jakarta.servlet.jsp.tagext.BodyTagSupport

    doEndTag, doInitBody, doStartTag, getBodyContent, getPreviousOut, release, setBodyContent

    Methods inherited from class jakarta.servlet.jsp.tagext.TagSupport

    findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface jakarta.servlet.jsp.tagext.Tag

    getParent, setPageContext, setParent
  • Constructor Details

    • QueryTag

      public QueryTag()
  • Method Details

    • getVar

      public String getVar()
      The variable this is assigned to.
      Returns:
      The name.
    • setVar

      public void setVar(String variable)
      Sets the variable this is assigned to.
      Parameters:
      variable - The name.
    • getScope

      public String getScope()
      The scope this is accessible in.
      Returns:
      The scope.
    • setScope

      public void setScope(String scope)
      Sets the scope this can be accessed from.
      Parameters:
      scope - The scope.
    • getJndi

      public String getJndi()
      Gets the JDNI name.
      Returns:
      The name.
    • setJndi

      public void setJndi(String jndi)
      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.JspException
      Executes 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:
      doAfterBody in interface jakarta.servlet.jsp.tagext.IterationTag
      Overrides:
      doAfterBody in class jakarta.servlet.jsp.tagext.BodyTagSupport
      Returns:
      SKIP_BODY to skip further body evaluation
      Throws:
      jakarta.servlet.jsp.JspException - If a database error occurs