<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> JSTL: SQL in action

SQL Update Execution


create table mytable ( nameid int primary key, name varchar(80) )

Inserting three rows into table

INSERT INTO mytable VALUES (1,'Paul Oakenfold') INSERT INTO mytable VALUES (2,'Timo Maas') INSERT INTO mytable VALUES (3,'Paul Adam') INSERT INTO mytable VALUES(4,'TU')

DONE: Inserting three rows into table

SELECT * FROM mytable
<%-- An example showing how to populate a table --%> <%-- Get the column names for the header of the table --%> <%-- Get the value of each column while iterating over rows --%>

Updating first row in table

UPDATE mytable SET name=? WHERE nameid=1 <%-- The Value for sql:param can be obtained from the JSP parameters --%>

DONE: Updating first row in table

SELECT * FROM mytable <%-- Yet another example showing how to populate a table --%> <%-- Get the column names for the header of the table --%> <%-- Each row is a Map object key'd by the column name --%> <%-- Get the value of each column while iterating over rows --%>

Deleting second row from table

DELETE FROM mytable WHERE nameid=2

DONE: Deleting second row from table

SELECT * FROM mytable <%-- Yet another example showing how to populate a table --%> <%-- Get the column names for the header of the table --%> <%-- Each row is a Map object key'd by the column name --%> <%-- Get the value of each column while iterating over rows --%>
drop table mytable