【正文】
3. If the JSP in the package good Cookie object to send to the client, the use of the response addCookie () method. Format: (c) 4. Save to read the client39。s first visit to a server on the JSP pages, JSP engines produce a session object, and assigned a String type of ID number, JSP engine at the same time, the ID number sent to the client, stored in Cookie, this session objects, and customers on the establishment of a onetoone relationship. When a customer to connect to the server of the other pages, customers no longer allocated to the new session object, until, close your browser, the clientserver object to cancel the session, and the conversation, and customer relationship disappeared. When a customer reopen the browser to connect to the server, the server for the customer to create a new session object. 四 . aplication target 1. What is the application: Servers have launched after the application object, when a customer to visit the site between the various pages here, this application objects are the same, until the server is down. But with the session difference is that all customers of the application objects are the same, that is, all customers share this builtin application objects. 2. application objects monly used methods: (1) public void setAttribute (String key, Object obj): Object specified parameters will be the object obj added to the application object, and to add the subject of the designation of a keyword index. (2) public Object getAttribute (String key): access to application objects containing keywords for. 五 . out targets out as a target output flow, used to client output data. out targets for the output data. 六 . Cookie 1. What is Cookie: Cookie is stored in Web server on the user39。 格式: (c) 4.讀取保存到客戶端的 Cookie,使用 request 對(duì)象的 getCookies()方法,執(zhí)行時(shí)將所有客戶端傳來的 Cookie對(duì)象以數(shù)組的形式排列,如果要取出符合需要的Cookie對(duì)象,就需要循環(huán)比較數(shù)組內(nèi)每個(gè)對(duì)象的關(guān)鍵字。它們最常 存放的地方是: c:\windows\cookies(在 Window2021中則是C:\Documents and Settings\您的用戶名 \Cookies ) Cookie是以 “關(guān)鍵字 key=值 value“的格式來保存紀(jì)錄的 . 2.創(chuàng)建一個(gè) Cookie對(duì)象,調(diào)用 Cookie對(duì)象的構(gòu)造函數(shù)可以創(chuàng)建 Cookie。 六. Cookie Cookie: Cookie是 Web服務(wù)器保存在用戶硬盤上的一段文本。 2. application對(duì)象常用方法 : (1)public void setAttribute(String key,Object obj): 將參數(shù) Object 指定的對(duì)象obj添加到 application對(duì)象中,并為添加的對(duì)象指定一個(gè)索引關(guān)鍵字。當(dāng)客戶再訪問連接該服務(wù)器的其他頁面時(shí),不再分配給客戶新的 session對(duì)象,直到客戶關(guān)閉瀏覽器后,服務(wù)器端該客戶的 session對(duì)象才取消,并且和客戶的會(huì)話對(duì)應(yīng)關(guān)系消失。 三. session對(duì)象 session: session對(duì)象是一個(gè) JSP內(nèi)置對(duì)象,它在第一個(gè) JSP頁面被裝載時(shí)自動(dòng)創(chuàng)建,完成會(huì)話期 管理。 ( 2) Java的運(yùn)行速度是用 class常駐內(nèi)存來完成的,所以它在一些情況下所使用的內(nèi)存比起用戶數(shù)量來說確實(shí)是 “最低性能價(jià)格比 ”了。 ( 4)多樣化和功能強(qiáng)大的開發(fā)工具支持?;旧峡梢栽谒衅脚_(tái)上的任意環(huán)境中開發(fā),在任意環(huán)境中進(jìn)行系統(tǒng)部署,在任意環(huán)境中擴(kuò)展。 JSP具備了 Java技術(shù)的簡(jiǎn)單易用,完全的面向?qū)ο?,具有平臺(tái)無關(guān)性且安全可靠,主要面向因特網(wǎng)的所有特點(diǎn)。目前較新的是 , 。 Web服務(wù)器在遇到訪問 JSP網(wǎng)頁的請(qǐng)求時(shí),首先執(zhí)行其中的程序段,然后將執(zhí)行結(jié)果連同 JSP文件中的 HTML代碼一起返回給客戶。 用 JSP開發(fā)的 Web應(yīng)用是跨平臺(tái)的,即能在 Linux下運(yùn)行,也能在其他操作系統(tǒng)上運(yùn)行。s machine. If you use IE browser to visit Web, you will see all stored on your hard drive on the Cookie. They are most often stored in places: c: \ windows \ cookies (in Window2021 is in the C: \ Documents and Settings \ your user name \ Cookies) Cookie is keyword key = value value to preserve the format of the record. 2. Targets the creation of a Cookie, Cookie object called the constructor can create a Cookie. Cookie object constructor has two string parameters: Cookie Cookie name and value. Cookie c = new Cookie ( username, john)。s request dynamic response to the client sent the data. 三 . session object 1. What is the session: session object is a builtin objects JSP, it in the first JSP pages loaded automatically create, plete the conversation of management. From a customer to open a browser and connect to the server, to close the browser, leaving the end of this server, known as a conversation. When a customer visits a server, the server may be a few pages link between repeatedly, repeatedly refresh a page, the server should be through some kind of way to know this is the same client, which requires session object. 2. session object ID: When a customer39。 3. JSP中如果要將封裝好的 Cookie對(duì)象傳送到客戶端,使用 response的addCookie()方法。 如果您使用 IE瀏覽器訪問 Web,您會(huì)看到所有保存在您的硬盤上的 Cookie。 out 對(duì)象用于各種數(shù)據(jù)的輸出。但是與session不同的是,所有客戶的 application對(duì)象都是同一個(gè),即所有客戶共享這個(gè)內(nèi)置的 application對(duì)象。 2. session對(duì)象的 ID:當(dāng)一個(gè)客戶首次 訪問服務(wù)器上的一個(gè) JSP頁面時(shí), JSP引擎產(chǎn)生一個(gè) session對(duì)象,同時(shí)分配一個(gè) String類型的 ID號(hào), JSP引擎同時(shí)將這個(gè) ID號(hào)發(fā)送到客戶端,存放在 Cookie中,這樣 session對(duì)象和客戶之間就建立了一一對(duì)應(yīng)的關(guān)系。 二 .response對(duì)象: 對(duì)客戶的請(qǐng)求做出動(dòng)態(tài)的響應(yīng),向客戶端發(fā)送數(shù)據(jù)。正是由于為了跨平臺(tái)的功能,為了極度的伸縮能力,所以極大的增加了產(chǎn)品的復(fù)雜性。從只有一個(gè)小的 Jar文件就可以運(yùn)行 Servlet/JSP,到由多臺(tái)服務(wù)器進(jìn)行集群和負(fù)載均衡,到多臺(tái) Ap