资源预览内容
第1页 / 共29页
第2页 / 共29页
第3页 / 共29页
第4页 / 共29页
第5页 / 共29页
第6页 / 共29页
第7页 / 共29页
第8页 / 共29页
第9页 / 共29页
第10页 / 共29页
亲,该文档总共29页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
本文是中英双语对照毕业设计论文外文文献翻译,下载之后直接可用!省去您找文献、pdf整理成word以及翻译的时间!一辈子也就一次的事!文献引用作者出处信息:Vishal Layka Learn Java for web development,2020 (如觉得年份太老,可改为近2年,毕竟很多毕业生都这样做)英文3478单词,21585字符(字符就是印刷符),中文5495汉字。(如果字数多了,可自行删减,大多数学校都是要求选取外文的一部分内容进行翻译的。)Building Web Applications Using Servlets and JSPThe core Internet protocols substantiate and sustain the Web, so understanding these protocols is fundamental to understanding how web applications are developed.The Internet is a colossal network of networks, and in general, all of the machines on the Internet can be classified into two types: the server and the client. The client is the machine requesting some information, and the server is the machine that provides that information. The information data that flows from the information provider (that is, the server) to the information requester (that is, the client) is bound by a definite rule that governs the marshaling of the information to be transmitted by the server and the unmarshaling of the information to be translated or read by the client. This rule is called the protocol. The web browser (that is, the client), the web server (that is, the server), and the web application all converse with each other through the Hypertext Transfer Protocol (HTTP). The clients send HTTP requests to the web servers, and the web servers return the requested data in the form of HTTP responses. The HTTP clients and the HTTP servers are the bricks and mortar that lay the foundation of the World Wide Web, and HTTP is the lingua franca of the Web.HTTP is a request-response stateless protocol, the corollary of which is that, from the web servers view, any request is the first request from the web browser. When a client makes a request for the resource, the request also encloses the identification of the resource being requested, in the form of a Uniform Resource Locator (URL). URLs are described in RFC 39861 as a uniform way of uniquely identifying a resource. URLs are designed to implicitly provide a means of locating a resource by describing its “location” on a network.A generic URL is a hierarchical sequence of components, structured as scheme:/hostName:portNumber/path/resource?query string.To identify the parts of a URL, consider a URL that lists the details of a book on your bookstore web site, as shown here:The host name and port number together are termed an authority. By default, a web server such as Tomcat, as explained later, listens for incoming requests on port 8080. Some parts of the URL shown in Figure 2-1 are optional, including the port number (which defaults to the well-known ports 80 and 443 for the HTTP and HTTPS schemes, respectively) and the query string.When present, a query string is a series of name-value pairs preceded with a question mark (?) and with an ampersand (&) separating the pairs.A web application is a collection of web components that work together to provide a specific functionality on the Web. In the Java EE specification, a web component is defined to be either a Servlet or a Java Server Page (JSP) page.The web application and its constituent components are managed and executed inside the web container, also called a servlet container, which provides additional features to the web application such as security. When the web server gets a request for specific functionality that a particular web component (such as a servlet or a JSP page) can provide, the web server forwards the request to the servlet container in which the web component resides. All requests for the dynamic content (that is, all requests to the web component that is responsible for generating the dynamic content) are mediated by the servlet container, as shown in Figure 2-2.The Java EE Servlet and JSP specifications describe the service contract that a servlet container must provide and specify how a servlet should use those services. In terms of implementation, a servlet is a Java class that acts as a dynamic web resource.ServletsServlets are the central processing unit of a Java web application and are responsible for most of the processing required by a web application. Specifically, a servlet is a Java class that implements the javax.servlet.Servlet interface. The Servlet interface defines the methods that all servlets must implement. “One ring to rule them all!” This interface, along with other methods, defines key life-cycle methods such as init(), service(), and destroy() to initialize a servlet, to service requests, and to remove a servlet from the server, respectively. Table 2-1 describes all the methods of the javax.servlet.Servlet interface.The life-cycle methods are invoked by the container at appropriate instants in a servlets life in the following sequence:1.The servlet is constructed and then initialized with the init method.2.Any calls from clients to the service method are handled.3.The servlet is then destroyed with the destroy method, garbage collected, a
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号