YouTip LogoYouTip

Jstl Sql Transaction Tag

Tutorial -- Learning is not just about technology, but also about dreams! Home HTML JAVASCRIPT CSS VUE REACT PYTHON3 JAVA C C++ C# AI GO SQL LINUX VS CODE BOOTSTRAP GIT Local Bookmarks JSP Tutorial JSP Tutorial JSP Introduction JSP Development Environment Setup Eclipse JSP/Servlet JSP Structure JSP Life Cycle JSP Syntax JSP Directives JSP Action Elements JSP Implicit Objects JSP Client Request JSP Server Response JSP HTTP Status Codes JSP Form Processing JSP Filters JSP Cookie Handling JSP Session JSP File Upload JSP Date Handling JSP Page Redirection JSP Hit Counter JSP Auto Refresh JSP Send Email JSP Advanced Tutorial JSP Standard Tag Library (JSTL) JSP Database Connection JSP XML Data Processing JSP JavaBean JSP Custom Tags JSP Expression Language JSP Exception Handling JSP Debugging JSP Internationalization JSP Send Email JSP Database Connection Deep Dive Software Web Service Web Design & Development Scripts Development Tools Programming Computer Science Web Services Scripting Languages Programming Languages <sql:transaction> Tag JSP Standard Tag Library The <sql:transaction> tag is used to wrap <sql:query> and <sql:update> tags within a transaction. You can encapsulate a large number of <sql:query> and <sql:update> operations within a <sql:transaction> tag, making them a single transaction. It ensures that database modifications are either committed or rolled back. Syntax <sql:transaction dataSource="<string>" isolation="<string>"/> Attributes The <sql:transaction> tag has the following attributes: Attribute Description Required Default dataSource The database to use (overrides default) No Default database isolation Transaction isolation level (READ_COMMITTED, READ_UNCOMMITTED, REPEATABLE_READ, or SERIALIZABLE) No Database default Example First, we need to create an Employees table in the TEST database and then add some records to it. The specific steps are as follows: Step 1: Open CMD and navigate to the installation directory: C:> C:>cd Program FilesMySQLbin C:Program FilesMySQLbin> Step 2: Log in to the database: C:Program FilesMySQLbin>mysql -u root -p Enter password: ******** mysql> Step 3: Create the Students table in the TEST database: mysql> use TEST; mysql> create table Students ( id int not null, first varchar (255), last varchar (255), dob date ); Query OK, 0 rows affected (0.08 sec) mysql> Create Data Records: Finally, create a few records in the Students table: mysql> INSERT INTO Students VALUES (100, 'Zara', 'Ali', '2002/05/16'); Query OK, 1 row affected (0.05 sec) mysql> INSERT INTO Students VALUES (101, 'Mahnaz', 'Fatma', '1978/11/28'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO Students VALUES (102, 'Zaid', 'Khan', '1980/10/10'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO Students VALUES (103, 'Sumit', 'Mittal', '1971/05/08'); Query OK, 1 row affected (0.00 sec) mysql> Now, write a JSP file that uses <sql:update> and <sql:transaction> to execute SQL UPDATE statements. The code within <sql:transaction> either executes completely or not at all: JSTL sql:transaction Tag UPDATE Students SET last = 'Ali' WHERE Id = 102 UPDATE Students SET last = 'Shah' WHERE Id = 103 INSERT INTO Students VALUES (104,'Nuha', 'Ali', '2010/05/26'); SELECT * from Students;
Emp ID First Name Last Name DoB
The result is as follows: JSP Standard Tag Library JSP Send Email JSP Database Connection ByteDance Coding Plan Supports mainstream large models like Doubao, GLM, DeepSeek, Kimi, MiniMax, officially supplied, stable and reliable. Configuration Guide ¥9.9 / month Activate Now iFlytek Spark Coding Plan Includes free model call quotas, DeepSeek, GLM, Kimi, MiniMax, a one-stop experience and deployment platform. Configuration Guide ¥3.9 / month Activate Now Click here to share notes Category Navigation Python / Data Science AI / Intelligent Development Front-end Development Back-end Development Database Mobile Development DevOps / Engineering Programming Languages Computer Fundamentals XML / Web Service .NET Website Building Advertisement JSP Tutorial JSP Tutorial JSP Introduction JSP Development Environment Setup Eclipse JSP/Servlet JSP Structure JSP Life Cycle JSP Syntax JSP Directives JSP Action Elements JSP Implicit Objects JSP Client Request JSP Server Response JSP HTTP Status Codes JSP Form Processing JSP Filters JSP Cookie Handling JSP Session JSP File Upload JSP Date Handling JSP Page Redirection JSP Hit Counter JSP Auto Refresh JSP Send Email JSP Advanced Tutorial JSP Standard Tag Library (JSTL) JSP Database Connection JSP XML Data Processing JSP JavaBean JSP Custom Tags JSP Expression Language JSP Exception Handling JSP Debugging JSP Internationalization Online Examples ·HTML Examples ·CSS Examples ·JavaScript Examples ·Ajax Examples ·jQuery Examples ·XML Examples ·Java Examples Character Sets & Tools · HTML Character Set Settings · HTML ASCII Character Set · JS Obfuscation/Encryption · PNG/JPEG Image Compression · HTML Color Picker · JSON Formatter · Random Number Generator Latest Updates · AI Ethics and Safety · How AI Works · AI Tool Landscape · Prompt Engineering · Introduction to AI · AI Beginner's Tutorial Large Model Multimodal (M... Site Information · Feedback · Disclaimer · About Us · Article Archives Follow WeChat My Favorites Bookmark Article Browsing History Clear All No records yet
← Jstl Xml Out TagJstl Sql Dateparam Tag →