The <tsx:dbmodify> tag establishes a connection to a database and then adds records to a database table.
Support for tsx tags in the JavaServer Pages engine are deprecated in WebSphere Application Server V6.0. Instead of using the tsx tags, you should use equivalent tags from the JavaServer Pages Standard Tag Library (JSTL).
The <tsx:dbmodify> tag does the following:
You can also obtain the user ID and password from the <tsx:dbconnect> tag if those values are provided in the <tsx:dbconnect> tag.
This section describes the syntax of the <tsx:dbmodify> tag.
<%-- Any valid database update commands can be placed within the DBMODIFY tag. --> <%-- Any other syntax, including HTML comments, are not valid. --> <tsx:dbmodify connection="connection_id"> </tsx:dbmodify>
where:
Represents the identifier of a <tsx:dbconnect> tag in this JSP file. The <tsx:dbconnect> tag provides the database URL, driver name, and (optionally) the user ID and password for the connection.
Represents valid database commands. Refer to your database documentation for details
In the following example, a new employee record is added to a database. The values of the fields are based on user input from this JavaServer Pages file and referenced in the database commands using the <tsx:getProperty> tag.
<tsx:dbmodify connection="conn" > insert into EMPLOYEE (EMPNO,FIRSTNME,MIDINIT,LASTNAME,WORKDEPT,EDLEVEL) values ('<tsx:getProperty name="request" property=request.getParameter("EMPNO") />', '<tsx:getProperty name="request" property=request.getParameter("FIRSTNME") />', '<tsx:getProperty name="request" property=request.getParameter("MIDINIT") />', '<tsx:getProperty name="request" property=request.getParameter("LASTNAME") />', '<tsx:getProperty name="request" property=request.getParameter("WORKDEPT") />', <tsx:getProperty name="request" property=request.getParameter("EDLEVEL") />) </tsx:dbmodify>