Class UpdateTagSupport

java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport
All Implemented Interfaces:
Serializable, SQLExecutionTag, BodyTag, IterationTag, JspTag, Tag, TryCatchFinally
Direct Known Subclasses:
UpdateTag

public abstract class UpdateTagSupport extends BodyTagSupport implements TryCatchFinally, SQLExecutionTag

Tag handler for <Update> in JSTL.

See Also:
  • Constructor Details

    • UpdateTagSupport

      public UpdateTagSupport()
  • Method Details

    • 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.
    • doStartTag

      public int doStartTag() throws JspException
      Prepares for execution by setting the initial state, such as getting the Connection
      Specified by:
      doStartTag in interface Tag
      Overrides:
      doStartTag in class BodyTagSupport
      Returns:
      EVAL_BODY_BUFFERED
      Throws:
      JspException - if an error occurred while processing this tag
      See Also:
    • 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.jsp.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:
    • doCatch

      public void doCatch(Throwable t) throws Throwable
      Just rethrows the Throwable.
      Specified by:
      doCatch in interface TryCatchFinally
      Parameters:
      t - The throwable exception navigating through this tag.
      Throws:
      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
    • addSQLParameter

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