【正文】
deal of label and a script terraces to use to e to show in the HTML page from the contents of JavaBeans creation or send a present in return. Because of the property that regards the module as the center of the JSP, it can drive Java and not the developer of Java uses equally. Not the developer of Java can pass the JSP label( Tags) to use the JavaBeans that the deluxe developer of Java establish. The developer of Java not only can establish and use the JavaBeans, but also can use the language of Java to e to control more accurately in the JSP page according to the expression logic of the first floor JavaBeans. 6 See now how JSP is handle claim of HTTP. In basic claim model, a claim directly was send to JSP page in. The code of JSP controls to carry on hour of the logic processing and module of JavaBeanses39。 本文將介紹 JSP 相關(guān)的知識(shí),以及 JavaBean 的相關(guān)內(nèi)容,當(dāng)然都是比較粗略的介紹其中的基本內(nèi)容,僅僅起到拋磚引玉的作用,如果讀者需要更詳細(xì)的信息,請(qǐng)參考相應(yīng)的JSP 的書籍。問(wèn)題不在于技術(shù)的能力,而是二者在便利性、生產(chǎn)率和可維護(hù)性上的不同。 Web 開(kāi)發(fā)人員可以將經(jīng)理集中在表示層( presentation layer)上。使用 JSP 標(biāo)識(shí)或者小腳本來(lái)生成頁(yè)面上的動(dòng)態(tài)內(nèi)容 (內(nèi)容是根據(jù)請(qǐng)求來(lái)變化的 )。 許多年前, Marty 受到邀請(qǐng) ,參加一個(gè)有關(guān)軟件技術(shù)的小型研討會(huì) .坐 在 Marty 旁邊的人是 James Gosling Java 編程語(yǔ)言的發(fā)明者。甚至 ASP(來(lái)自于前述經(jīng)理所在公司的一項(xiàng)產(chǎn)品 )都在 JSP 出現(xiàn)之前推廣了這種方式。分開(kāi)內(nèi)容和顯示邏輯的好處是,更新頁(yè)面外觀的人員不 必懂得 Java代碼,而更新 JavaBeans 類的人員也不必是設(shè)計(jì)網(wǎng)頁(yè)的行家里手,就可以用帶 JavaBeans類的 JSP 頁(yè)面來(lái)定 義 Web 模板,以建立一個(gè)由具有相似的外觀的頁(yè)面組成的網(wǎng)站。 JSP 的機(jī)制 要理解 JSP怎樣聯(lián)合以上各種所提到的技術(shù)的優(yōu)點(diǎn),從而輕而易舉地實(shí)現(xiàn)各種效果,用戶必須首先了解 “組件為中心的網(wǎng)頁(yè)開(kāi)發(fā) ”和 “頁(yè)面為中心的網(wǎng)頁(yè)開(kāi)發(fā) ”的區(qū)別。簡(jiǎn)而言之,隨著 Web 應(yīng)用程序 的復(fù)雜性不斷提升,以頁(yè)面為中心的開(kāi)發(fā)方式的局限性變得明顯起來(lái)。 Java 開(kāi)發(fā)者不僅可以創(chuàng)建和使用 JavaBeans,還能在 JSP 頁(yè)中使用 Java 語(yǔ)言來(lái)更精密地控制基于底層 JavaBeans 的表達(dá)邏輯。這樣,當(dāng)網(wǎng)站的訪問(wèn)者請(qǐng)求一個(gè) JSP 頁(yè)時(shí),在它不知道的情況下,一個(gè)已經(jīng)生成的、預(yù)編譯過(guò)的 Servlet 實(shí)際上將完成所有的工作,非常隱蔽而又高效。使用JSP 技術(shù)可以很方便地將一大堆 JSP 頁(yè)面組合成為一個(gè) Web 應(yīng)用程序。 和傳統(tǒng)的 CGI 相比較, JSP 有相當(dāng)?shù)膬?yōu)勢(shì)。 Beans 可以是 JavaBeans 或 EJB組件。 作為一種以組件為中心的開(kāi)發(fā)平臺(tái), JSP 出現(xiàn)了。在腳本環(huán)境中書寫的表達(dá)邏輯被鎖在頁(yè)面內(nèi),只有通過(guò)剪切和粘貼才能被重用。解釋式的動(dòng)態(tài)網(wǎng)頁(yè)開(kāi)發(fā)工具如 ASP、 PHP3 等由于速度等原因已經(jīng)滿足不了當(dāng)前大型電子商務(wù)應(yīng)用的需要了,傳統(tǒng)的開(kāi)發(fā)技術(shù)都在向編譯執(zhí)行的 方式改變,如 ASP→ASP+ ;PHP3→PHP4 。JSP 把 Java 作為默認(rèn)的腳本語(yǔ)言,然而,就像 ASP 可以使用其他語(yǔ)言 (如 JavaScript 和VBScript)一樣, JSP 規(guī)范也允許使用其他語(yǔ)言 。 他們會(huì)持續(xù)關(guān)注這項(xiàng)技術(shù) ,如果這項(xiàng)技術(shù)變得流行起來(lái) ,他 們會(huì)遵循公司的 “ 接受并擴(kuò)充 (embrace and extend)” 的策略 .此時(shí) , Gosling 隨意地插話說(shuō) “ 你的意思其實(shí)就是不接受且不擴(kuò)充 (disgrace and distend)。得益于 Java 的跨平臺(tái)的特性, Servlet 也是平臺(tái)無(wú)關(guān)的,實(shí)際上,只要符合 Java Servlet 規(guī)范, Servlet 是完全與平臺(tái)無(wú)關(guān)且是與 Web 服務(wù)器無(wú)關(guān)的。事實(shí)上, 幾乎所有 8 的項(xiàng)目都會(huì)同時(shí)用到這兩種技術(shù)。 能夠使用標(biāo)準(zhǔn)的網(wǎng)站開(kāi)發(fā)工具。下面我們簡(jiǎn)單的對(duì)它進(jìn)行介紹。盡管 JSP 規(guī)范是由 Sun 公司制定的,但任何廠商都可以在自己的系統(tǒng)上實(shí)現(xiàn) JSP。t do any translation, if reader would like to, can call it as small service procedure. The Servlet is similar to traditional CGI, ISAPI, NSAPI etc. Web procedure development the function of the tool in fact, at use the Java Servlet hereafter, the customer need not use again the lowly method of CGI of efficiency, also need not use only the ability e to born page of Web of dynamic state in the method of API that a certain fixed Web server terrace circulate. Many servers of Web all support the Servlet, even not support the Servlet server of Web directly and can also pass the additional applied server and the mold pieces to support the Servlet. Receive benefit in the characteristic of the Java crossplatform, the Servlet is also a terrace irrelevant, actually, as long as match the norm of Java Servlet, the Servlet is plete to have nothing to do with terrace and is to have nothing to do with server of Web. Because the Java Servlet is internal to provide the service by the line distance, need not start a progress 3 to the each claimses, and make use of the multithreading mechanism can at the same time for several claim service, therefore the efficiency of Java Servlet is very high. But the Java Servlet also is not to has no weakness, similar to traditional CGI, ISAPI, the NSAPI method, the Java Servlet is to make use of to output the HTML language sentence to carry out the dynamic state web page of, if develop the whole website with the Java Servlet, the integration process of the dynamic state part and the static state page is an evilforeboding dream simply. For solving this kind of weakness of the Java Servlet, the SUN released the JSP. A number of years ago, Marty was invited to attend a small 20person industry roundtable discussion on software technology. Sitting in the seat next to Marty was James Gosling, inventor of the Java programming language. Sitting several seats away was a highlevel manager from a very large software pany in Redmond, Washington. During the discussion, the moderator brought up the subject of Jini, which at that time was a new Java technology. The moderator asked the manager what he thought of it, and the manager responded that it was too ea