JSTL SQL <sql:transaction> Tag

The <sql:transaction> tag is used to group <sql:query> and <sql:update> into transactions. You can put as many <sql:query> and <sql:update> as statements inside <sql:transaction> to make them a single transaction.

It ensures that the database modifications performed by the nested actions are either committed or rolled back if an exception is thrown by any nested action.

Now let us write a JSP which will make use of <sql:update> along with <sql:transaction> to execute a SQL UPDATE statement. Here code inside <sql:transaction> either would be exeucted completely or not at all: