【正文】
he power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particular puter platform in the Java programming language you could also do in assembly language. But it still matters which you choose. 2 JSP provides the following benefits over servlets alone: ? It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax. ? You can use standard Website development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags. ? You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the plexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content. Now, this discussion is not to say that you should stop using servlets and use only JSP instead. By no means. Almost all projects will use both. For some requests in your project, you will use servlets. For others, you will use JSP. For still others, you will bine them with the MVC architecture . You want the appropriate tool for the job, and servlets, by themselves, do not plete your toolkit. SOURCE OF JSP The technique of JSP of the pany of Sun, making the page of Web develop the personnel can use the HTML perhaps marking of XML to design to turn the end page with format. Use the perhaps small script future life of marking of JSP bees the dynamic state on the page contents.( the contents changes according to the claim of) The Java Servlet is a technical foundation of JSP, and the large Web applies the development of the procedure to need the Java Servlet to match with with the JSP and then can plete, this name of Servlet es from the Applet, the local translation method of now is a lot of, this book in order not to misconstruction, decide the direct adoption Servlet but don39。JSP The Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape pany of server side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP pares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun pany of, any factory can carry out the JSP on own system. The After Sun release the JSP( the Java Server Pages) formally, the this kind of new Web application development technique very quickly caused the people39。t satisfy current the large electronic merce needs appliedly, traditional development techniques are all at to edit and translate the executive way change, such as the ASP → ASP+。JSP Java Server Pages(JSP)是一種基于 web 的腳本編程技術,類似于網景公司的服務器端 Java 腳本語言 —— serverside JavaScript(SSJS)和微軟的 Active Server Pages(ASP)。 JSP 為創(chuàng)建高度動態(tài)的 Web 應用提供了一個獨特的開發(fā)環(huán)境。 JSP 與 Microsoft的 ASP 技術非常相似。因而,從根本上, JSP 頁面能夠執(zhí)行的任何任務都可以用 servlet 來完成。 和單獨使用 servlet 相比, JSP 提供下述好處: JSP 中 HTML 的編寫與維護更為簡單。 可以對開發(fā)團隊 進行劃分。依據開發(fā)團隊的大小,及項目的復雜程度,可以對靜態(tài) HTML 和動態(tài)內容進行弱分離( weaker separation)和強分離( stronger separation)。我們總是希望用適當的工具完成相對應的工作,僅僅是 servlet 并不 一定能夠勝任所有工作 。 Servlet 其實和傳統(tǒng)的 CGI、 ISAPI、 NSAPI 等 Web 程序開發(fā)工具的作用是相似的,在使用 Java Servlet 以后,用戶不必再使用效率低下的 CGI 方式,也不必使用只能在某個固定 Web 服務器平臺運行的 API 方式來動態(tài)生成 Web 頁面。 但 Java Servlet也不是沒有缺點,和傳統(tǒng)的 CGI、 ISAPI、 NSAPI 方式相同, Java Servlet是利用輸出 HTML 語句來實現(xiàn)動態(tài)網頁的,如果用 Java Servlet 來開發(fā)整個網站,動態(tài)部分和靜態(tài)頁面的 整合過程會非常難以實現(xiàn)。在討論過程中 ,研討會的主席提出了 Jini 的議題 ,這在當時是一項新的 Java 技術 。 Java 團隊并 沒有發(fā)明這一思想 將頁面設計成由靜態(tài) HTML 和用特殊標簽標記的動態(tài)代碼混合組成 .。 9 JSP 是建立在 Java servlets 模型之上的表達層技術,它使編寫 HTML 變得更簡單。然而,作為一種腳本語言, JSP 又顯得過于強大了,在 JSP 中幾乎可以使用全部的 Java 類。 當然,也可以利用 Java Servlet 來控制網站的邏輯,通過Java Servlet 調用 JSP 文件的方式來將網站的邏輯和內容分離。實際上,有一些 JSP 引擎就是采用的其他腳本語言,如 EMACScript、 WebL等,但實際上這幾種腳本語言也是構建在 Java 上面,編譯為 Servlet 來實現(xiàn)的。這種以頁面為中心的模型容易學習并且得到相當快速的發(fā)展。其事實上,企業(yè)中可重用組件的應用早已經很成熟,沒有人愿意為它們的應用程序重寫那些邏輯。 JavaBeans 和 ActiveX 被 “快速應用程序開發(fā) ”(RAD)工具發(fā)行商推廣給Java 和 Windows 應用程序開發(fā)者用來快速開發(fā)復雜的程序。由于 JSP 的以組件為中心的性質,它可以被 Java 和非 Java 開發(fā)者同樣使用。在基本請求模型 中,一個請求直接被送到 JSP 頁中。 JSP 引擎實際上要把 JSP 標簽、 JSP 頁中的 Java 代碼甚至連同靜態(tài) HTML 內容都轉換為大塊的 Java 代碼。 JSP 引擎只需在 Servlet 代碼最后被修改后編譯一次,然后這個編譯過的 Servlet 就可以被執(zhí)行了。而且對于 CGI 來說,每一個訪問就需要新增加一個進程來處理,進程不斷地建立和銷毀對于作為 Web 服務器的計算機將是不小的負