Class QueryTagSupport

    • Constructor Detail

      • QueryTagSupport

        public QueryTagSupport()
    • Method Detail

      • setVar

        public void setVar​(java.lang.String var)
        Setter method for the name of the variable to hold the result.
      • setScope

        public void setScope​(java.lang.String scopeName)
        Setter method for the scope of the variable to hold the result.
      • addSQLParameter

        public void addSQLParameter​(java.lang.Object o)
        Called by nested parameter elements to add PreparedStatement parameter values.
        Specified by:
        addSQLParameter in interface SQLExecutionTag
        Parameters:
        o - the PreparedStatement parameter value
      • doEndTag

        public int doEndTag()
                     throws JspException

        Execute the SQL statement, set either through the sql attribute or as the body, and save the result as a variable named by the var attribute in the scope specified by the scope attribute, as an object that implements the Result interface.

        The connection used to execute the statement comes either from the DataSource specified by the dataSource attribute, provided by a parent action element, or is retrieved from a JSP scope attribute named javax.servlet.jstl.sql.dataSource.

        Specified by:
        doEndTag in interface Tag
        Overrides:
        doEndTag in class BodyTagSupport
        Returns:
        EVAL_PAGE
        Throws:
        JspException - if an error occurred while processing this tag
        See Also:
        Tag.doEndTag()
      • doCatch

        public void doCatch​(java.lang.Throwable t)
                     throws java.lang.Throwable
        Just rethrows the Throwable.
        Specified by:
        doCatch in interface TryCatchFinally
        Parameters:
        t - The throwable exception navigating through this tag.
        Throws:
        java.lang.Throwable - if the exception is to be rethrown further up the nest chain.
      • doFinally

        public void doFinally()
        Close the Connection, unless this action is used as part of a transaction.
        Specified by:
        doFinally in interface TryCatchFinally