【正文】
最常被誤解的項(xiàng)已經(jīng)突出標(biāo)示出來。 ? 您應(yīng)該用 SCRIPT標(biāo)簽,使用客戶端 JavaScript創(chuàng)建在鼠標(biāo)下會(huì)更改的圖像,這不會(huì)由于服務(wù)器使用 JSP而改變。 ? 我們的服務(wù)器正在運(yùn)行 。對于 JSP替代技術(shù)的爭論幾乎只是集中在技術(shù)特性上,而可移植性、標(biāo)準(zhǔn)化和集成性也十分重 要。許多人都曾指出過 JSP中能夠改進(jìn)的功能。 與 JavaScript相比 JavaScript和 Java編程語言完全是兩碼事,前者一般用于在客戶端動(dòng)態(tài)生成HTML,在瀏覽器載入文檔時(shí)構(gòu)建網(wǎng)頁的部分內(nèi)容。 這是否表示您只可以學(xué)習(xí) JSP,將 Servlet丟到一邊呢?當(dāng)然不是!由于以下4種原因, JSP開發(fā)人員需要了解 Servlet: ( 1) JSP頁面會(huì)轉(zhuǎn)換成 Servlet。然而,當(dāng)前版本的 ColdFusion滿足 J2EE服務(wù)器的環(huán)境,允許開發(fā)者容易的混合使用 ColdFusion和 Servlet/JSP代碼。但有些應(yīng)用,這種差異卻非常重要。其他這些技術(shù)中 ,有一些也很不錯(cuò) ,在某些情況下也的確是合情合理的選擇 .然而 ,在其他情形中 ,JSP明顯要更好一些。隔幾 個(gè)位置 ,是來自華盛頓一家大型軟件公司的高級經(jīng)理。 Web開發(fā)人員可以將經(jīng)理集中在表示層( presentation layer)上。問題不在于技術(shù)的能力,而是二者在便利性、生產(chǎn)率和可維護(hù)性上的不同。s version is irrelevant. If the browser supports the Java 2 platform, you use the normal APPLET (or Java plugin) tag and would do so even if you were using nonJava technology on the server. ? You do not need Java I/O to read image files。 with JSP you can use Java for the real code and are not tied to a particular server product. However, the current release of ColdFusion is within the context of a J2EE server, allowing developers to easily mix ColdFusion and servlet/JSP code. Versus PHP PHP (a recursive acronym for PHP: Hypertext Preprocessor) is a free, opensource, HTMLembedded scripting language that is somewhat similar to both ASP and JSP. One advantage of JSP is that the dynamic part is written in Java, which already has an extensive API for working, database access, distributed objects, and the like, whereas PHP requires learning an entirely new, less widely used language. A second advantage is that JSP is much more widely supported by tool and server vendors than is PHP. Versus Pure Servlets JSP doesn39。 you aren39。t understand servlet programming. 3. Some tasks are better acplished by servlets than by JSP. JSP is good at generating pages that consist of large sections of fairly well structured HTML or other character data. Servlets are better for generating binary data, building pages with highly variable structure, and performing tasks (such as redirection) that involve little or no output. 4. Some tasks are better acplished by a bination of servlets and JSP than by either servlets or JSP alone. Versus JavaScript JavaScript, which is pletely distinct from the Java programming language, is normally used to dynamically generate HTML on the client, building parts of the Web page as the browser loads the document. This is a useful capability and does not normally overlap with the capabilities of JSP (which runs only on the server). JSP pages still include SCRIPT tags for JavaScript, just as normal HTML pages do. In fact, JSP can even be used to dynamically generate the JavaScript that will be sent to the client. So, JavaScript is not a peting technology。s memory jspInit called _jspService called Page first written Request 1 Yes Yes Yes Yes Yes Request 2 No No No No Yes Server restarted Request 3 No No Yes Yes Yes Request 4 No No No No Yes Page modified Request 5 Yes Yes Yes Yes Yes Request 6 No No No No Yes 中文翻譯 JSP技術(shù)概述 一、 JSP的好處 JSP頁面最終會(huì)轉(zhuǎn)換成 servler。即使對那些對 JSP一無所知的 HTML工具,我們也可以使用,因?yàn)樗鼈儠?huì)忽略 JSP標(biāo)簽( JSP tags)。針對項(xiàng)目中的某些請求,您可能會(huì)在 MVC構(gòu)架下組合使用這兩項(xiàng)技術(shù)。甚至 ASP(來自于前述經(jīng)理所在公司的一項(xiàng)產(chǎn)品 )都在 JSP出現(xiàn)之前推廣了這種方式。 首先 ,JSP可以移植到多種操作系統(tǒng)和 Web服務(wù)器 ,您不必僅僅局限于部署在Windows 和 IIS上盡管核心 .NET平臺(tái)可以在好幾種非 Windows平臺(tái)上運(yùn)行,但 ASP這一部分不可以。使用 JSP,動(dòng)態(tài)部分是用 Java編寫的 ,而非 VBScript過其他 ASP專有的語言 ,因此 JSP更為強(qiáng)勁 ,更適合于要求組件重用的復(fù)雜應(yīng)用。實(shí)際上, JSP文檔在后臺(tái)被自動(dòng)轉(zhuǎn)換成 Servlet。 JSP擅長生成由大量組織有序的結(jié)構(gòu)化 HTML或 其他字符數(shù)據(jù)組成的頁面。 JavaScript也可以用在服務(wù)器端,最因人注意的是 SUN ONE(以前的 iPla)、IIS 和 BroadVision服務(wù)器。使用擴(kuò)充 JSP和 Servlet技術(shù)的第三方工具,如 Apache Structs,是一種很好的思路,只要該工具帶來的好處能夠補(bǔ)償工具帶來的額外復(fù)雜性。 此外,業(yè)界對 JSP和 Servlet技術(shù)的巨大支持使得這兩項(xiàng)技術(shù)都有了巨大的進(jìn)步,從而減輕了對 JSP