A Servlet's Job Servlets are Java programs that run on Web or application servers, acting as a middle layer between requests coming from Web browsers or other HTTP clients and databases or applications on the HTTP server. Their job is to perform the following tasks.34466
1.1 Read the explicit data sent by the client.
The end user normally enters this data in an HTML form on a Web page. However, the data could also come from an applet or a custom HTTP client program.
1.2 Read the implicit HTTP request data sent by the browser.
Figure 1-1 shows a single arrow going from the client to the Web server (the layer where servlets and JSP execute), but there are really two varieties of data: the explicit data that the end user enters in a form and the behind-the-scenes HTTP information. Both varieties are critical. The HTTP information includes cookies, information about media types and compression schemes the browser understands, and so on.
1.3 Generate the results.
This process may require talking to a database, executing an RMI or EJB call, invoking a Web service, or computing the response directly. Your real data may be in a relational database. Fine. But your database probably doesn't speak HTTP or return results in HTML, so the Web browser can't talk directly to the database. Even if it could, for security reasons, you probably would not want it to. The same argument applies to most other applications.You need the Web middle layer to extract the results inside a document.
1.4 Send the explicit data (i.e., the document) to the client.
This document can be sent in a variety of formats, including text (HTML or XML), binary (GIF images), or even a compressed format like gzip that is layered on top of some other underlying format. But, HTML is by far the most common format, so an important servlet/JSP task is to wrap the results inside of HTML.
1.5 Send the implicit HTTP response data.
Figure 1-1 shows a single arrow going from the Web middle layer (the servlet or JSP page) to the client. But, there are really two varieties of data sent: the document itself and the behind-the-scenes HTTP information. Again, both varieties are critical to effective development. Sending HTTP response data involves telling the browser or other client what type of document is being returned (e.g., HTML), setting cookies and caching parameters, and other such tasks.
英文出处:
An Overview of Servlet and JSP Technology Nagle, Wiegley
B.原文的翻译 Servlet和JSP技术简述
摘要:Servlet程序在服务器端运行,动态地生成Web页面与传统的CGI和许多其他类似CGI的技术相比,Java Servlet具有更高的效率,更容易使用,功能更强大,具有更好的可移植性,更节省投资。论文网
关键字:JSP技术;Servlet;HTTP服务
Servlet的功能
Servlet是运行在Web或应用服务器上的Java程序,它是一个中间层,负责连接来自Web浏览器或其他HTTP客户程序的请求和HTTP服务器上的数据库或应用程序。Servlet的工作是执行西门的任务,如图1.1所示 。
1.1 Web中间件的作用
1.1 读取客户发送的显式数据
最终用户一般在页面的HTML表单中输入这些数据。然而,数据还有可能来自applet或定制的HTTP客户程序。
1.2 读取由浏览器发送的隐式请求数据
图1.1中显示了一条从客户端到Web服务器的单箭头,但实际上从客户端传送到Web服务器的数据有两种,它们分别为用户在表单中输入的显式数据,以及后台的HTTP信息。两种数据都很重要。HTTP信息包括cookie、浏览器所能识别的媒体类型和压缩模式等。
1.3 生成结果
这个过程可能需要访问数据库、执行RMI或EJB调用、调用Web服务,或者直接计算得出对应的响应。实际的数据可能存储在关系型数据库中。该数据库可能不理解HTTP,或者不能返回HTML形式的结果,所有Web浏览器不能直接与数据库进行会话。即使它能够做到这一点,为了安全上的考虑,我们也不希望让它这么做。对应大多数其他应用程序,也存在类似的问题。因此,我们需要Web中间层从HTTP流中提取输入数据,与应用程序会话,并将结果嵌入到文档中。
- 上一篇:钢筋对裂缝宽度的影响英文文献和中文翻译
- 下一篇:LODGSERV在客户和酒店经营管理英文文献和中文翻译
-
-
-
-
-
-
-
十二层带中心支撑钢结构...
杂拟谷盗体内共生菌沃尔...
酸性水汽提装置总汽提塔设计+CAD图纸
java+mysql车辆管理系统的设计+源代码
乳业同业并购式全产业链...
电站锅炉暖风器设计任务书
河岸冲刷和泥沙淤积的监测国内外研究现状
中考体育项目与体育教学合理结合的研究
大众媒体对公共政策制定的影响
当代大学生慈善意识研究+文献综述