【正文】
l characteristics, while portability, standardization, and integration is also important. For example, Servlet and JSP specification defines a standard Web application directory structure, and provides for the deployment of Web applications, standard file (. War files). JSP is patible with all servers must support these standards. We can create filters to any trees in the role of Servlet and JSP page, but not for nonstandard resources. Web application security settings are the same. In addition, the industry39。s one product) are in JSP before the appearance to promote this approach. In fact, JSP not only adopted this general concept, it even use the same special number, and ASP tags. So the question bees: Why use JSP, instead of using other technologies? Our first reaction is that we are not arguing about all the people should be done. These other technologies, there are some very good, in some cases, is indeed a reasonable choice. However, in other cases, JSP is significantly better. Here are a number of reasons. With. NET and Active Server Pages (ASP) pared to . NET is Microsoft designed a technology. is a direct petition with the servlets and JSP technology. The advantages of JSP is reflected in two aspects. First of all, JSP can be ported to multiple operating systems and Web servers, you do not have to be limited to be deployed in Windows and IIS on the core though. NET platform can be several nonWindows platforms, but not this part of the ASP. You can expect to be important application deployment to multiple servers and operating systems. For certain applications, such differences have little impact. However, some applications, this difference is very important. Secondly, for some applications, the underlying choice of language is essential. For example, while. NET39。s acceptance and expansion (embrace and extend) strategy. At this point, Gosling casually interjected to say do you mean actually do not accept and does not expand (disgrace and distend). In this, Gosling39。 表 1 各種情況下的 JSP 操作 將 JSP 頁面轉(zhuǎn)換成 servlet 編譯 Servlet 將 Servlet 載入到服務(wù)器內(nèi)存中 調(diào)用 jspInit 調(diào)用 _jspService 頁面初次創(chuàng)建 請求 1 有 有 有 有 有 請求 2 無 無 無 無 有 服務(wù)器重啟后 請求 3 無 無 有 有 有 請求 4 無 無 無 無 有 頁面修改后 請求 5 有 有 有 有 有 請求 6 無 無 無 無 有 JSP Technical Overview A, JSP benefits 2, JSP pages will eventually be converted into servler. Thus, fundamentally, JSP pages can perform any task can be used servler to plete. However, this does not mean that the underlying equivalence servler and JSP pages for all conditions are equally applicable. The problem is not technical ability, but both the convenience, productivity and maintainability different. After all, in a particular platform can be done with the Java programming language, things, the same can be done in assembly language, but it is still important to choose which language. And single use servler pared, JSP provides the following benefits: 3, ? JSP in the HTML, the preparation and maintenance easier. JSP can use regular HTML: no additional backslash, no additional pairs of quotes, and no implied Java syntax. 4, ? can use standard web development tools. Even for those who know nothing about JSP39。在參考該表時,要注意,由 JSP 頁面生成的 servlet 使用 _jspService 方法( GET 和 POST 請求都調(diào)用該函數(shù)),不是 doGet 或 doPost 方 法。 表 1 列出一些常見的情形,講述在該種情況下每一步是否發(fā)生。 Servlet 在編譯后,載入到服務(wù)器的內(nèi)容中,初始化并執(zhí)行。 ? 當(dāng)然,您不需要采取什么措施來阻止客戶看到 JSP 標(biāo)簽,這些標(biāo)簽在服務(wù)器上進行處理,發(fā)送給客戶的輸出中并不出現(xiàn)。 ? 瀏覽器根本不 “ 支持 ”JSP 它們看到的只是 JSP頁面的輸出。 您不需要 Java? I/O 來讀取圖像文件,您只需將圖像放在存儲 Web 資源的目錄中(即 WEBINF/classes 向上兩級的目錄),并輸出一個正常的IMG 標(biāo)簽。因此: ? 如果要將使用 Swing 組件的 applet 放到網(wǎng)頁中,重要的是瀏覽器的Java 版本,和服務(wù)器的 Java 版本無關(guān)。我應(yīng)該怎么做? 當(dāng)我們的客戶在瀏覽器中使用 “Vi ew? Source” (查看源代碼)時,如何阻止他們看到 JSP 標(biāo)簽? 所有這些問題都基于瀏覽器對服務(wù)器端的過程在有所了解的假定