毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 英语论文 >> 正文

jsp和数据库外文文献原文及翻译 第3页

更新时间:2011-6-19:  来源:毕业论文
jsp和数据库外文文献原文及翻译 第3页
 Integrating with JavaBeans components
The examples so far have been fairly simple, but most database operations are going to be more sophisticated than these simple queries and updates. So now that we've covered some basic principles of using JDBC with JSP pages, let's conclude with a slightly more complex, and certainly more common, type of application.
The example for this section will show one way to support visitor-supplied content on a Web site. In other words, we want to allow visitors to read database content associated with a URI and to contribute additional content. Such content is fairly common on modern Web sites. The same basic parts can be used to construct:
Review pages, such as those found on Amazon.com
Links pages
Bulletin boards
Wikiwebs
An only slightly more elaborate version of the JSP components in this example can implement Web pages that seem very different, authored by designers of varying technical backgrounds. All that the pages would appear to have in common is a provision for visitor-contributed content.
Our annotation example uses an HTML form. When using HTML forms with JSP, it is convenient to use a bean whose properties map to the form fields.
Integration with JavaBeans components is one of the better-designed aspects of JSP technology. Unfortunately, the integration between beans and JDBC is not seamless at all, so for our JDBC work at DevTech, we developed a package that provides not only integration between beans and JDBC but also the necessary exception handling, relieving the programmer from having to deal with the details.
The annotation example 原文请找腾讯752018766辣,文-论'文.网http://www.751com.cn/ , an SQL query, and an Object array to fill in the placeholders in the query. In this case, the only placeholder is for the page's URL. The result is a database cursor object, which is essentially a type of iterator.
Integration with JavaBeans components is one of the better-designed aspects of JSP technology. Unfortunately, the integration between beans and JDBC is not seamless at all, so for our JDBC work at DevTech, we developed a package that provides not only integration between beans and JDBC but also the necessary exception handling, relieving the programmer from having to deal with the details.
The annotation example uses two of the query and update methods from the com.devtech.sql package. The particular query method used passes a bean class, an SQL query, and an Object array to fill in the placeholders in the query. In this case, the only placeholder is for the page's URL. The result is a database cursor object, which is essentially a type of iterator.
We've used scriptlets in this example only to show you, a programmer, what is happening. If they were replaced with declarative tags, they would be clear to the page designer, but uninformative to you.
The logic is straightforward. The annotation.getCursor() call acquires a connection to the server, issues the query, and sets up a database cursor object, annotations, on the result set. Each time annotations.next() is called, a new row is fetched from the result set, and its values moved into a bean whose reference is returned from the method. The particular next() method being used takes a bean parameter to populate. Although we could have the cursor instantiate a new bean for each row, reusing the bean is more efficient.
Notice that neither the actual query, nor the update, is present in the presentation page. The included page, which sets up the environment for the presentation page, also includes the setProperty and update actions. Those actions are independent of the presentation page; only the contract embodied by the annotation bean's properties is significant. This is in keeping with a policy to separate presentation from model behavior. The page designer is fully able to change how the presentation is rendered but has no access to how the database is integrated. If a change is to be effected in updating or querying the database, it is delegated to a JSP programmer.

上一页  [1] [2] [3] [4] 下一页

jsp和数据库外文文献原文及翻译 第3页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。