国产精品婷婷久久久久久,国产精品美女久久久浪潮av,草草国产,人妻精品久久无码专区精东影业

純servlet:重新考慮視圖 外文文獻(xiàn)譯文和原文.doc

約22頁DOC格式手機(jī)打開展開

純servlet:重新考慮視圖 外文文獻(xiàn)譯文和原文,純servlet:重新考慮視圖對(duì)于具有動(dòng)態(tài)內(nèi)容的web頁面,可以使用java™server pages(jsp)技術(shù)將開發(fā)人員和ui設(shè)計(jì)人員的工作分離開來。遺憾的是,jsp對(duì)于許多設(shè)計(jì)人員來說太復(fù)雜了,所以java開發(fā)人員只好自己處理jsp代碼,這往往會(huì)產(chǎn)生令人不滿意的結(jié)果。本文演示一種非正統(tǒng)的替代方法:通...
編號(hào):11-207871大小:237.50K
分類: 論文>外文翻譯

內(nèi)容介紹

此文檔由會(huì)員 wanli1988go 發(fā)布

純servlet:重新考慮視圖
對(duì)于具有動(dòng)態(tài)內(nèi)容的Web頁面,可以使用Java™Server Pages(JSP)技術(shù)將開發(fā)人員和UI設(shè)計(jì)人員的工作分離開來。遺憾的是,JSP對(duì)于許多設(shè)計(jì)人員來說太復(fù)雜了,所以Java開發(fā)人員只好自己處理JSP代碼,這往往會(huì)產(chǎn)生令人不滿意的結(jié)果。本文演示一種非正統(tǒng)的替代方法:通過使用簡單的helper對(duì)象,根據(jù)純servlet構(gòu)建Web界面。
設(shè)計(jì)JSP的目的是將Web開發(fā)人員的任務(wù)與設(shè)計(jì)動(dòng)態(tài)頁面UI的非開發(fā)人員的任務(wù)分離開來。遺憾的是,JSP對(duì)于許多設(shè)計(jì)人員來說太復(fù)雜了,為解決各種動(dòng)態(tài)內(nèi)容問題添加的軟件層讓他們覺得非常棘手。(例如,國際化要求將文本存儲(chǔ)在其他地方并通過鍵來引用。)所以對(duì)于大多數(shù)項(xiàng)目,Java開發(fā)人員只好自己處理JSP代碼,這常常會(huì)包含本屬于設(shè)計(jì)人員的工作,使他們的精力消耗在標(biāo)記庫和其他東西上,無法集中于Java代碼。
與正統(tǒng)的方式不同,可以使用簡單的helper對(duì)象,根據(jù)常規(guī)servlet構(gòu)建簡潔優(yōu)美的 Web 界面。本文講解如何以標(biāo)準(zhǔn)的Java形式編寫動(dòng)態(tài)Web頁面的視圖輸出。我將解釋這種方法的好處,并用一個(gè)計(jì)分應(yīng)用程序演示這種方法,這個(gè)程序管理一個(gè)NCAA三月狂熱獎(jiǎng)金池。
HTML 是動(dòng)態(tài)的
這種純servlet 方法非常簡單。它涉及一個(gè) servlet 基類和一個(gè)定制的寫出器對(duì)象,servlet 子類使用這個(gè)對(duì)象產(chǎn)生輸出。代碼很簡潔,因?yàn)榇蠖鄶?shù) HTML 封裝在helper對(duì)象的方法中,都可以按需重寫。代碼重用總是令人愉快,而且大多數(shù) Web 站點(diǎn)的頁面共享許多HTML,所以重用應(yīng)該是個(gè)重要的考慮因素。HTML 輸出方法產(chǎn)生直觀緊湊的servlet 代碼,因此可維護(hù)性很高,這使代碼的維護(hù)成本差不多直接與代碼規(guī)模成正比。通過將JSP界面重寫成純servlet,可以將代碼縮減三分之二。


Pure servlets: Rethink the view
For Web pages with dynamic content, Java™Server Pages (JSP) technology is touted as a means of separating the developer's concerns from those of the UI designer. Unfortunately, JSP is too complex for many designers, so Java developers tend to handle the JSP code themselves, often with unsatisfactory results. This article demonstrates the advantages of an unorthodox alternative: using simple helper objects to build a Web interface based on servlets alone.
This technique is not recommended for teams with designated template designers. It's intended for Java Web developers who write and maintain their own HTML output code.
JSP was designed to keep Web developers' tasks separate from those of the nondevelopers who design dynamic pages' UIs. Unfortunately, JSP is a bit too complicated for many designers, with layer upon layer added to solve the multifarious problems of dynamic content. (Internationalization, for example, requires that text be stored elsewhere and referenced by keys.) So Java developers handle the JSP code for most projects themselves, often rewriting designers' work and entangling it with taglibs and other devices to avoid entangling it with Java code.