毕业设计说明书英文文献及中文翻译学生姓名:学号南社区0906064109学院:电子与计算机科学技术学院专业:网络工程指导教师:刘爽英2018年6月An Overview of Servlet and JSP TechnologyGildas Avoi ne and Philippe Oechsli nEPFL, Lausa nne, Switzerla nd1.1A Servlet's JobServlets are Java programs that run on Web or application servers, acting as a middle layer betwee n requests coming from Web browsers or other HTTP clie nts and databases or applicatio ns on the HTTP server. Their job is to perform the followi ngtasks, as illustrated in Figure 1-1b5E2RGbCAPWeb Server(Servlets JSP)Figure 1-1 1.Read the explicit data sent by the client. DatabaseLegacy Application Java Application Web ServiceClient (End User)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 clie nt program EanqFDPw2.Read the implicit HTTP request data sent by the browser X DiTa9E3dFigure 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 en ters in a form and the behi nd-the-sce nes HTTP in formati on. Both varieties are critical. The HTTP information includes cookies, information about media types and compressi on schemes the browser un dersta nds, and sc RTCTpUDGiT3.Gen erate 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 relati onal database. Fine. But your database probably does n't speak HTTP or retur n 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 incoming data from the HTTP stream, talk to the application, and embed the results in side a docume nt5PCzVD7HxA4.Send the explicit data (i.e., the document> to the client-BHrnAiLgThis document can be sent in a variety of formats, including text (HTML or XML>, bi nary (GIF images>, or eve n a compressed format like gzip that is layered on top of some other un derly ing format. But, HTML is by far the most com mon format, so an importa nt servlet/JSP task is to wrap the results in side of HTML H AQX74J0X5.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 clie nt. But, there are really two varieties of data sent: the docume nt itself and the behind-the-scenes HTTP information. Again, both varieties are critical to effective developme nt. Sending HTTP resp onse data invo Ives telli ng the browser or other clie nt what type of docume nt is being retur ned (e.g., HTML>, sett ing cookies and cach ing parameters, and other such task LD AYtR y KfE1.2Why Build Web Pages Dynamically?many client requests can be satisfied by prebuilt documents, and the server would handle these requests without invoking servlets. In many cases, however, a static result is not sufficie nt, and a page n eeds to be gen erated for each request. There are a nu mber of reas ons why Web pages n eed to be built on-the-f Z y z6ZB2Ltk1.The Web page is based on data sent by the clie dvZ f vkwMi1For instanee, the results page from search engines and order-confirmation pages at on li ne stores are specific to particular user requests. You don't know what to display un til you read the data that the user submits. Just remember that the user submits two kinds of data: explicit (i.e., HTML form data> and implicit (i.e., HTTP request headers>. Either kind of in put can be used to build the output page. In particular, it is quite com mon to builda user-specific page based on a cookie value.ni4ZNxi2.The Web page is derived from data that changes frequent f y.xvxotoc。
If the page changes for every request, then you certainly need to build the response at request time. If it changes only periodically, however, you could do it two ways: you could periodically build a new Web page on the server (in depe nden tly of clie nt requests>, or you could wait and only build the page whe n the user requests it. The right approach depends on the situation, but sometimes it is more convenient to do the latter: wait for the user request. For example, a weather report or news headli nes site might build the pages dyn amically, perhaps retur ning a previously built page if that page is still up todate sixE2yxpq53.The Web page uses information from corporate databasesor other server-sideSourceS6ewMyirQFLIf the information is in a database,you need server-side processing even if the clie nt is using dyn amic Web content such as an applet. Imagi ne using an applet by itself for a search engine site:avU42VRUs "Downloading 50 terabyte applet, please wait!" Obviously, that is silly。