Java Reference
In-Depth Information
After dropping the
DB Insert
item into our page, we are prompted for
additional information.
The value of the
Variable Name
field is a variable of type
java.lang.Integer
which will hold the number of rows that were inserted into the database after the
INSERT
statement was executed.
The
Scope
field must contain the scope where the value of the
Variable Name
ield
will be stored.
The
Data Source
field must contain the JNDI name of the data source used to obtain
a database connection. This data source must be added as a
Resource References
to
our application's
web.xml
deployment descriptor as explained earlier in this chapter.
Finally, the value of the
Insert Statement
field allows us to specify the SQL
INSERT
statement to be executed.
After entering the appropriate data for all fields in the
Insert DB Insert
window, the
following markup is generated in our page:
<sql:update var="insertedRows" dataSource="jdbc/sample">
INSERT INTO customer (customer_id, name,
discount_code,zip) values
(((select max(customer_id) from customer) + 1),
'Ensode Technology, LLC', 'H', '22030')
</sql:update>