Book Image

JDBC 4.0 and Oracle JDeveloper for J2EE Development

Book Image

JDBC 4.0 and Oracle JDeveloper for J2EE Development

Overview of this book

Table of Contents (20 chapters)
JDBC 4.0 and Oracle JDeveloper for J2EE Development
Credits
About the Author
About the Reviewer
Preface

Creating a New Row


Next, create a new row in the Web RowSet. Click on the Create Row link in the ModifyWebRowSet.jsp JSP.

The CreateRow.jsp is displayed. Specify the row values to add and click on Apply.

In the CreateRow.jsp, the input values are retrieved from the JSP and the insertRow() method of the WebRowSetQuery class is invoked. The WebRowSetQuery object is retrieved from the session object:

WebRowSetQuery query=( webrowset.WebRowSetQuery)
session.getAttribute("query");

In the insertRow() method OracleWebRowSet object cursor is moved to the insert row:

webRowSet.moveToInsertRow();

Set the row values with the updateString() method:

webRowSet.updateString(1, journal);
webRowSet.updateString(2, publisher);
webRowSet.updateString(3, edition);
webRowSet.updateString(4, title);
webRowSet.updateString(5, author);

Add the row to the OracleWebRowSet:

webRowSet.insertRow();

A new row is added in the OracleWebRowSet object. A new row is not yet added to the database. CreateRow.jsp is listed as...