freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

外文翻譯---將servlet和jsp組合使用-jsp程序(留存版)

2025-07-26 09:55上一頁面

下一頁面
  

【正文】 開發(fā)出來的應(yīng)用非常復(fù)雜、難以閱讀、不容易復(fù)用,而且對(duì)以后的維護(hù)和修改也會(huì)造成困難。s lifecycle. It creates an instance of the servlet class when needed, passes requests to the instance for processing, and eventually removes the instance. For an HttpServlet, the container calls the following methods at the appropriate times in the servlet lifecycle. Besides the doGet( ) and doPost( ) methods, there are methods corresponding to the other HTTP methods: doDelete( ), doHead( ), doOptions( ), doPut( ), and doTrace( ). Typically you don39。m afraid you39。當(dāng)一個(gè)客戶向服務(wù)器遞交一個(gè)請(qǐng)求時(shí),服務(wù)器把請(qǐng)求送給 Servlet, Servlet 負(fù)責(zé)處理請(qǐng)求并生成響應(yīng),然后送給服務(wù)器,再由服務(wù)器發(fā)送給客戶。 Servlet引擎裝載這個(gè)類, 處理來自客戶的請(qǐng)求,并把結(jié)果返回給客戶,如下圖所示: 圖 1: 調(diào)用 JSP頁面的流程 沈陽航空 航天大學(xué) 北方科技學(xué)院畢業(yè)設(shè)計(jì) (外文翻譯 ) 14 以后再有客戶訪問這個(gè)頁面的時(shí)候,只要該文件沒有發(fā)生過更改, JSP 引擎就直接調(diào)用已經(jīng)裝載的 Servlet。 除了 doGet()和 doPost()方法之外,還有一些對(duì)應(yīng)于其他 HTTP方法的方法:doDelete()、 doHead()、 doOptiongs()、 doPut()和 doTrace()。 過濾器 過濾器是一種組件,可以解釋對(duì) servlet、 JSP頁面或靜態(tài)頁面的請(qǐng)求以及發(fā)送給客戶端之前 的應(yīng)答??梢栽谛枰蚕碣Y源的 servlet 和 JSP 頁面中包含初始化共享資源的代碼,但是更標(biāo)準(zhǔn)的方法是在一個(gè)位置放 置所有這些代碼,并在假設(shè)資源已經(jīng)初始化和可用的情況下,使應(yīng)用程序的其他部分可以正常工作。 使用 servlet集中處理 請(qǐng)求 將 servlet 作為所有應(yīng)用程序請(qǐng)求的公共入口時(shí),可以獲得對(duì)應(yīng)用程序頁面流的整體控制。今天,大部分 servlet容器都支持這個(gè)約定,即使 servlet規(guī)范中并沒有正式的定義。 ? 用 Java代碼進(jìn)行請(qǐng)求處理效果最佳: servlet作為控制器正符合需要。接口定義的是事件相應(yīng)的方法。該接口定義了為應(yīng)答行為體獲取數(shù)序程序或流的方法。該類實(shí)現(xiàn)了 Servlet接口,并提供了使用 HTTP處理的附加方法。如果你有一個(gè)支持 JSP 的Web 服務(wù)器,并且有一個(gè) JSP 文件,你可以把它放倒 任何靜態(tài) HTML文件可以放置的位置,不用編譯,不用打包,也不用進(jìn)行 ClassPath 的設(shè)置,就可以像訪問普通網(wǎng)頁那樣訪問它,服務(wù)器會(huì)自動(dòng)幫你做好其他的工作。 早期的動(dòng)態(tài)網(wǎng)頁主要采用 CGI( Common Gateway Interface,公共網(wǎng)關(guān)接口)技術(shù),你可以使用不同的語言編寫 CGI程序,如 VB、 C/C++或 Delphi 等。s suitable for most servlets, and the DELETE and PUT HTTP methods are rarely used in a web application. It39。s important to realize that the container creates only one instance of each servlet. This means that the servlet must be thread safe able to handle multiple requests at the same time, each executing as a separate thread through the servlet code. Without getting lost in details, you satisfy this requirement with regards to instance variables if you modify the referenced objects only in the init( ) and destroy( ) methods, and just read them in the request processing methods. 6 Compiling and Installing a Servlet To pile a servlet, you must first ensure that you have the JAR file containing all Servlet API classes in the CLASSPATH environment variable. The JAR file is distributed with all web containers. Tomcat includes it in a file called , located in the mon/lib directory. On a Windows platform, you include the JAR file in the CLASSPATH. . Reading a Request One of the arguments passed to the doGet( ) and doPost( ) methods is an object that implements the HttpServletRequest interface. This interface defines methods that provide access to a wealth of information about the request. Generating a Response Besides the request object, the container passes an object that implements the HttpServletResponse interface as an argument to the doGet( ) and doPost( ) methods. This interface defines methods for getting a writer or stream for the response body. It also defines methods for setting the response status code and headers. Using Filters and Listeners The servlet specification defines two ponent types beside servlets: filters and listeners. These two types were introduced in the Servlet specification, so if you39。雖然 CGI技術(shù)發(fā)展成熟且功能強(qiáng)大,但由于編程困難、效率 低下、修改復(fù)雜等缺點(diǎn),所以有逐漸被取代的趨勢。 JSP 文件看起來就像一個(gè)普通靜態(tài) HTML 文件,只不過里面包含了一些 Java 代碼。 Servlet的生命周期 Web 容器管理 servlet 生命周期的所有方面。它還定義了設(shè)置應(yīng)答狀態(tài)代碼和首部的方法。當(dāng)應(yīng)用程序啟動(dòng)是,容易會(huì)注冊(cè)監(jiān)聽器類,然后該容器會(huì)在合適的事件調(diào)用那些事件方法 。 ? 必須很容易改編外觀呈現(xiàn):這正是 JSP的反光點(diǎn),也就是作為視圖。 。將這些代碼放置到 Java類中后,就可以使用普通的 Java編譯程序和調(diào)試程序來修復(fù)潛在的問題。例如,它們可能需要對(duì)數(shù)據(jù)庫或某些其他外部數(shù)據(jù)源的引用,還可能在內(nèi)存中創(chuàng)建一個(gè)初始消息緩存,以便即使是第一個(gè)請(qǐng)求數(shù)據(jù)也可以提供更快的訪問。這兩種類型是在Servlet ,因此,如果你使用的是不支持該版本規(guī)范的容器,恐怕就不能繼續(xù)學(xué)習(xí)了 。對(duì)于 HttpServlet來說,容器會(huì)在 servlet生命周期的適當(dāng)時(shí)間調(diào)用方法。當(dāng)我們?cè)L問一個(gè)JSP頁面的時(shí)候,這個(gè)文件首先會(huì)被 JSP引擎翻譯為一個(gè) Java源文件,其實(shí)就是一個(gè)Servlet,并進(jìn)行編譯,然后像其他 Servlet一樣,由 Servlet引擎來處理。 與 CGI相似, Servlet支持請(qǐng)求 /響應(yīng)模型。t yet support this version of the specification, I39。t implement these methods。事實(shí)上,在 CSDN 的 JSP/Servlet 論壇中,經(jīng)??梢钥吹揭恍┨釂枺a很長,可以邏輯卻不是很清晰,大量的 HTML和 Java代碼混雜在一起,讓人看得一頭霧水?,F(xiàn)在有許多商業(yè)應(yīng)用服務(wù)器支持 JSP技術(shù),比如 BEA WebLogic、 IBM WebSphere、 JRun 等等。該接口定義了 Web容器用來管理 servlet和與之交互的方法。該接口定義的方法可提供對(duì)關(guān)于請(qǐng)求的許多信息的訪問。 新類型的監(jiān)聽器遵循的是標(biāo)準(zhǔn) Java 事件模型。 ? 數(shù)據(jù)庫訪問 bean 必須在 應(yīng)用程序啟動(dòng)時(shí)可用于所有其他的部分:應(yīng)用程序生命周期時(shí)間監(jiān)聽器是用了該任務(wù)的
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計(jì)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1