

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、<p> 附錄1 外文參考文獻(譯文)</p><p><b> JSP內置對象</b></p><p> 有些對象不用聲明就可以在JSP頁面的Java程序片和表達式部分使用,這就是JSP的內置對象。</p><p> JSP的內置對象有:request、response、session、application、out.&l
2、t;/p><p> response和request對象是JSP內置對象中較重要的兩個,這兩個對象提供了對服務器和瀏覽器通信方法的控制。直接討論這兩個對象前,要先對HTTP協(xié)議—Word Wide Wed底層協(xié)議做簡單介紹。</p><p> Word Wide Wed是怎樣運行的呢?在瀏覽器上鍵入一個正確的網(wǎng)址后,若一切順利,網(wǎng)頁就出現(xiàn)了。使用瀏覽器從網(wǎng)站獲取HTML頁面時,實際在使用超
3、文本傳輸協(xié)議。HTTP規(guī)定了信息在Internet上的傳輸方法,特別是規(guī)定吧瀏覽器與服務器的交互方法。從網(wǎng)站獲取頁面時,瀏覽器在網(wǎng)站上打開了一個對網(wǎng)絡服務器的連接,并發(fā)出請求。服務器收到請求后回應,所以HTTP協(xié)議的核心就是“請求和響應”。</p><p> 一個典型的請求通常包含許多頭,稱作請求的HTTP頭。頭提供了關于信息體的附加信息及請求的來源。其中有些頭是標準的,有些和特定的瀏覽器有關。一個請求還可能包
4、含信息體,例如,信息體可包含HTML表單的內容。在HTML表單上單擊Submit鍵時,該表單使用ACTION=”POST”或ACTION=”GET”方法,輸入表單的內容都被發(fā)送到服務器上。該表單內容就由POST方法或GET方法在請求的信息體中發(fā)送。</p><p> 服務器發(fā)送請求時,返回HTTP響應。響應也有某種結構,每個響應都由狀態(tài)行開始,可以包含幾個頭及可能的信息體,稱為響應的HTTP頭和響應信息體,這些
5、頭和信息體由服務器發(fā)送給客戶的瀏覽器,信息體就是客戶請求的網(wǎng)頁的運行結果,對于JSP頁面,就是網(wǎng)頁的靜態(tài)信息。用戶可能已經(jīng)熟悉狀態(tài)行,狀態(tài)行說明了正在使用的協(xié)議、狀態(tài)代碼及文本信息。例如,若服務器請求出錯,則狀態(tài)行返回錯誤及對錯誤描述,比如HTTP/1.1 404 Object Not Found。若服務器成功響應了對頁面的請求,則返回包含“200 OK”的狀態(tài)行。</p><p> HTTP通信協(xié)議是客戶與服
6、務器之間一種提交(請求)信息與響應信息(request/response)的通信協(xié)議。在JSP中,內置對象request封裝了用戶提交的信息,那么該對象調用相應的方法可以獲取封裝的信息,使用該對象可以獲取用戶提交的信息。內置對象request對象是實現(xiàn)了SerletRequest接口類的一個實例,可以在Tomcat服務器的webapps\tomcat-docs\servletapi中查找SerletRequest接口的方法。</p
7、><p> 當客戶訪問一個服務器的頁面時,會提交一個HTTP請求,服務器收到請求時,返回HTTP響應。響應和請求類似,也有某種結構,每個響應都由狀態(tài)行開始,可以包含幾個頭及可能的信息體。與request對象相對應的對象是response對象??梢杂胷esponse對象對客戶的請求作出動態(tài)響應,向客戶端發(fā)送數(shù)據(jù)。比如,當一個客戶請求訪問一個JSP頁面時,該頁面用page指令設置頁面的contentType屬性的值是t
8、ext/html,那么JSP引擎將這種屬性值響應客戶對頁面的請求,將頁面的靜態(tài)部分返回給客戶,用戶瀏覽器接收到該響應就會使用HTML解釋器解釋執(zhí)行所收到的信息。</p><p> HTTP協(xié)議是一種無狀態(tài)協(xié)議。一個客戶向服務器發(fā)出請求(),然后服務器返回響應(),連接就被關閉了。在服務器端不保留連接的有關信息,因此當下一次連接時,服務器已經(jīng)沒有以前的連接信息了,無法判斷這一次連接和以前的連接是否屬于同一個客戶。
9、當一個客戶訪問一個Web服務目錄時,可能會在這個服務器目錄的幾個頁面反復連接、反復刷新一個頁面或不斷的向一個頁面提交信息等,服務器應當通過某種辦法知道這是同一個客戶。Tomcat服務器可以使用內置session(會話)對象記錄有關連接的信息。內置對象session由Tomcat服務器負責創(chuàng)建,session是實現(xiàn)了HttpSession接口類的一個實例,可以在Tomcat服務器的webapps\tomcat-docs\servletap
10、i中查找HttpSession接口方法。</p><p> 我們已經(jīng)知道,當一各客戶第一次訪問Web服務目錄上的一個JSP頁面,JSP引擎創(chuàng)建一個和該客戶相對應的session對象,當客戶在所訪問的Web服務目錄的各個頁面之間瀏覽時,這個session對象都是同一個,而且不同客戶的session對象是互不相同的。與session對象不同的是 application對象,該對象由服務器負責創(chuàng)建,每個Web服務目錄
11、下的application對象被訪問該服務目錄的所有的用戶共享,不同Web服務目錄下的application互不相同。</p><p> Out對象是一個輸出流,用來向客戶端輸出數(shù)據(jù)。Out對象可調用如下的方法用于各種數(shù)據(jù)的輸出,例如:</p><p> Out.print(boolean),out.println(boolean):輸出一個布爾值。</p><p&
12、gt; Out.print(char),out.println(char):輸出一個布爾值。</p><p> Out.print(double),out.println(double):輸出一個布爾值。</p><p> Out.print(float),out.println(float):輸出一個布爾值。</p><p> Out.print(long
13、),out.println(long):輸出一個布爾值。</p><p> Out.print(String),out.println(String):輸出一個布爾值。</p><p> Out.newLine():輸出一個換行符。</p><p> Out.flush():輸出緩沖區(qū)里的內容。</p><p> Out.close(
14、):關閉流。</p><p> 方法println 和print的區(qū)別是:println會向緩存區(qū)寫入一個換行,而print不寫入換行。但是瀏覽器的顯示區(qū)域目前不識別println寫入的換行,如果希望瀏覽器顯示換行,應當向瀏覽器寫入<br>實現(xiàn)換行。</p><p> 附錄2 外文參考文獻(原文)</p><p> JSP built-in ob
15、jects</p><p> Some objects do not have a statement on the JSP page in the Java program and the expression of some of the use of film, which is built-in objects of the JSP.</p><p> JSP has the
16、built-in objects: request, response, session, application, out. </p><p> response and request object is a built-in object in the JSP of the two more important, the two clients, the server and browser commun
17、ication control. Directly to discuss the two objects before the first of the HTTP protocol-Word Wide Wed underlying agreement to do a brief introduction.</p><p> Word Wide Wed is how to run it? In a browser
18、, type the correct URL, if all goes well, there have been web page. The use of browser access to HTML pages from the site, the actual use of Hypertext Transfer Protocol. HTTP provides information on the Internet transmis
19、sion methods, in particular the provisions of your browser and server interaction method. Page from the website, the browser open on the site of a connection to the server on the network, and issued the request. Server i
20、n response to re</p><p> A typical request usually contains a number of the first, known as the HTTP request header. Provided the first body of information and request additional information sources. Some o
21、f the first is a standard, and some of the specific browser. A request may also contain information, such as, information form body can contain HTML content. In HTML form, click Submit button, the form to use ACTION = &q
22、uot;POST" or ACTION = "GET" method, enter the contents of the form have been sent to the server. The con</p><p> Server to send request, return HTTP response. Have some structure to respond t
23、o each by the state to respond to the start line, may include a number of head and body of information may be known as the HTTP response headers and body to respond to information, the head and body of information sent b
24、y the server to the client browser, body of information that customers request the results page for the JSP page is static information pages. Users may have been familiar with the status line, status li</p><p&
25、gt; HTTP communication protocol between a client and a server to submit (Request) information and respond to information (request / response) communication protocol. In the JSP, the built-in object request package of in
26、formation submitted by the user, then the object can call the appropriate method to obtain the information package, the use of the object can get users to submit information. Built-in object request is a type of interfac
27、e SerletRequest an example of Tomcat server in the webapps \ tomc</p><p> When a customer visits a page the server will be submitted to an HTTP request, the server receives a request, the HTTP response to r
28、eturn. Response and a similar request, but also a structure, by each state to respond to the start line, may include a number of head and body may be information. With the corresponding request object is the target respo
29、nse. Response object can be used on the client's request for a dynamic response, send data to the client. For example, when a client requests access</p><p> HTTP protocol is a stateless protocol. A clie
30、nt request to the server (), and then the server returns in response to (), connection has been closed. Not to retain the server-side connection information, so next time to connect, the server has no previous connection
31、 information to be able to judge this time to connect and the former belong to the same connection is a client. When a customer visits a Web services directory may be in the directory server to connect a few pages again
32、and repeated co</p><p> We already know that when a customer's first visit to the Web services directory on a JSP page, JSP engine and the client to create a corresponding object of the session, when cu
33、stomers visit the various Web services directory browsing between pages, this session are the same object, and session objects of different clients is a separate one. With the session object is a different application ob
34、ject, the object created by the server, each Web services application directory service object was to </p><p> Out object is an output stream, used to output data to the client. Out object can call the foll
35、owing method has been applied to the output of various data, such as:</p><p> Out.print (boolean), out.println (boolean): output a boolean value. </p><p> Out.print (char), out.println (char):
36、 output a boolean value. </p><p> Out.print (double), out.println (double): output a boolean value. </p><p> Out.print (float), out.println (float): output a boolean value. </p><p&g
37、t; Out.print (long), out.println (long): output a boolean value. </p><p> Out.print (String), out.println (String): output a boolean value. </p><p> Out.newLine (): output a newline. </p&
38、gt;<p> Out.flush (): output buffer's content. </p><p> Out.close (): close the stream.</p><p> Println and print methods is the difference between: println to write a cache line,
39、and the print is not written into the line. However, the browser display area is not currently written into the identification of the println line, if you want to show the line browser, it should be written to the browse
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 計算機專業(yè)畢業(yè)外文翻譯--jsp簡介
- 計算機專業(yè)畢業(yè)設計外文翻譯
- 計算機專業(yè)畢業(yè)外文翻譯--jsp技術概述
- 計算機專業(yè)畢業(yè)設計-外文翻譯
- 計算機專業(yè)畢業(yè)設計外文翻譯27
- 計算機專業(yè)畢業(yè)設計外文翻譯--internet
- 計算機專業(yè)畢業(yè)設計(論文)外文翻譯--jsp技術發(fā)展史
- 計算機專業(yè)外文翻譯---jsp 應用框架
- 計算機專業(yè)畢業(yè)設計外文資料翻譯3
- 計算機專業(yè)畢業(yè)設計-外文翻譯--matlab 介紹
- 計算機畢業(yè)設計外文翻譯
- 計算機專業(yè)畢業(yè)設計外文文獻翻譯部分
- 計算機專業(yè)畢業(yè)設計外文翻譯--數(shù)據(jù)庫
- 計算機專業(yè)畢業(yè)設計文獻翻譯
- 計算機專業(yè)畢業(yè)外文翻譯
- 計算機專業(yè)畢業(yè)設計(論文)外文翻譯2篇
- 計算機專業(yè)畢業(yè)設計外文翻譯--ds1820
- 計算機專業(yè)外文翻譯--計算機
- 計算機專業(yè)畢業(yè)設計外文翻譯--組策略的概述
- 計算機專業(yè)--畢業(yè)設計外文翻譯--論網(wǎng)站建設技術
評論
0/150
提交評論