Đang chuẩn bị liên kết để tải về tài liệu:
Java 2 Bible Enterprise Edition phần 3
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Bạn cũng có thể tìm thấy các liên kết với các thư viện thẻ JSP khác nhau tại http://jsptags.com/ và tại Quá trình phát triển và sử dụng một thẻ thư viện có ba phần cơ bản. Đầu tiên, lập trình viên tạo ra và biên dịch một lớp Java thường kéo dài hoặc lớp TagSupport hoặc lớp BodyTagSupport trong | Chapter 7 Using JDBC to Interact with SQL Databases rset.execute Once this method is called it will remove any current contents and create a new set of contents for this instance. If you ve forgotten to set some values exceptions are also thrown. However all the setup information is retained between calls. This makes the execute method call great if you want multiple queries for the same thing with little overhead. For example if you want to display a single Web page that contains a listing of all printed material books and magazines you use the following code RowSet rset new . rset.setCommand SELECT FROM Product WHERE category rset.setString 1 books rset.setDataSourceName jdbc Oracle rset.execute do stuff with the rowset rset.setString 1 magazines rset.execute now process the new information Synchronizing back with the database Because RowSets are just an extended form of ResultSet you can make all the same changes to the underlying data source. How to get them back to the underlying database is an interesting problem as it depends on what your RowSet represented in the first place was it just some offline version of the ResultSet or was it used as a live JavaBean representation of the data or was it used in some other fashion What you did in the first place determines how information gets back to the database. When acting as a JavaBean the RowSet typically represents a live view of the underlying database just as the ResultSet does. Therefore all the methods act in the same way. A call to updateRow or deleteRow will make those changes immediately. Note The definition of immediately is also influenced by the transaction-handling of the connection. We look at this in more detail later in Chapter 23 but the actual results may not make it to the database until you call commit on the Connection that this RowSet used to fill its information. For RowSet instances that work as an offline representation of the database there is no defined way of making those changes .