Servlets和JSP页的最佳实践

以下是资料介绍,如需要完整的请充值下载. 本资料已审核过,确保内容和网页里介绍一致.  
无需注册登录,支付后按照提示操作即可获取该资料.
资料介绍:


作者:Qusay H. Mahmoud

2003年3月

Java Servlet技术和JavaServer页(JSP页)是Java服务器端技术,他们已经控制了服务器端Java技术市场;他们已经成为商业网络应用的标准。众多JAVA开发者热爱这些技术有许多原因, 包括:技术比较简单易学, 而且实现了只写一次,就可以在任何地方运行的网络应用模式。 更重要的是, 如果最有效的使用下面的实践, Servlets和JSP页 帮助分开Web的表示和内容。 最佳实践是发展高质量的,可以再度被使用的和容易维护的基于servlet 和以 JSP 为基础的网络应用的较好方法。例如,在部分HTML 文件的区段中嵌入JAVA代码(scriptlets)能造成很复杂的但不是很有效率的应用程序, 而且很难重复使用,维护。最佳实践能改变全部这些问题。

在这一篇文章中,我将为servlets 和 JSP 页提出最佳实践的重要性;我设想你已经具有这两项技术的基础知识。这篇文章:

简单介绍Java servlets和 JAVAServer页(JSP页)

为servlets 和 JSP 页提供一些提示、技巧、规则。

给 servlets 和 JSP 页提供最佳实践。

  Servlets 和 JSP 页的概述

类似通常的通用网关接口 (CGI) 脚本,servlets 支持一个请求和响应编程模式。当客户端将一个请求送到服务器的时候,服务器将请求发送到 servlet。servlet 这时创建一个响应使服务器发送返回给客户端。与CGI 脚本不同,servlets与HTTP服务器运行在同一个进程里。

当发出客户端请求的时候,调用service方法而且传递一个请求和响应对象。Servlet首先判断该请求是一个GET操作或POST操作。然后它可以



外文原文(复印件)

Servlets and JSP Pages Best Practices



by Qusay H. Mahmoud

March 2003

Java Servlet technology and JavaServer Pages (JSP pages) are server-side technologies that have dominated the server-side Java technology market; they've become the standard way to develop commercial web applications. JAVA developers love these technologies for myriad reasons, including: the technologies are fairly easy to learn, and they bring the Write Once, Run Anywhere paradigm to web applications. More importantly, if used effectively by following best practices, servlets and JSP pages help separate presentation from content. Best practices are proven approaches for developing quality, reusable, and easily maintainable servlet- and JSP-based web applications. For instance, embedded JAVA code (scriptlets) in sections of HTML documents can result in complex applications that are not efficient, and difficult to reuse, enhance, and maintain. Best practices can change all that.

In this article, I'll present important best practices for servlets and JSP pages; I assume that you have basic working knowledge of both technologies. This article:

* Presents an overview of Java servlets and JAVAServer pages (JSP pages)

* Provides hints, tips, and guidelines for working with servlets and JSP pages

* Provides best practices for servlets and JSP pages

Overview of Servlets and JSP Pages

Similar to Common Gateway Interface (CGI) scripts, servlets support a request and response programming model. When a client