A first look at JavaServer Faces(jsf 1)
Summary?In??September?2002,??the?early??access?(EA)??draft?of?the?JavaServer?Faces?specification?was?released?under?Java?Specification?Request?(JSR)?127.?JavaServer?Faces,??with?a??well-defined?request??processing?lifecycle??and?a?rich?component?hierarchy,?will?profoundly??affect?the?development?of?Java??2?Platform,?Enterprise?Edition?(J2EE)?applications.?In?Part?1?of?this?two-part?series,?David?Geary?introduces?JavaServer?Faces?and?explores?its?fundamental?concepts.?(3,000?words;?November?29,?2002)?????
摘要:在2002年9月的127次JSR會(huì)議上發(fā)表了JavaServer?Faces規(guī)范的早期草稿版本。具有良好定義的請(qǐng)求處理生命周期和豐富的組件層次結(jié)構(gòu)的JSR將會(huì)深遠(yuǎn)的影響到J2EE應(yīng)用的開(kāi)發(fā)。在本篇分為兩部分的文稿的第一部分中,David?Geary將介紹JSR并初步探討它的基本概念。
????
????Recently,?I?had?the?good?fortune?of?training?and?mentoring?a?group?of?novice?Java?developers??as?we?implemented??a?complex?Web?application?using??Struts,??Enterprise??JavaBeans?(EJB),?servlets,?JavaServer??Pages?(JSP),?and??the?JSP??Standard??Tag?Library?(JSTL).?As?it??turned?out,?the?project?was?a??success;??it??came?in??under?budget??and?on???time,?and???had?numerous???features?not?originally??envisioned.??As??you?might??imagine,??we???faced?many??technical?challenges?along?the??way;?the?most?significant?were:?
最近,我在使用Struts、EJB、JSP和JSTL開(kāi)發(fā)一個(gè)復(fù)雜的Web應(yīng)用的過(guò)程中能有幸培訓(xùn)和指導(dǎo)一組共同參與開(kāi)發(fā)的初級(jí)Java開(kāi)發(fā)人員。當(dāng)開(kāi)發(fā)完成以后,整個(gè)項(xiàng)目非常成功并且是在經(jīng)費(fèi)預(yù)算和進(jìn)度規(guī)劃內(nèi)完成的,而且實(shí)現(xiàn)了很多原先沒(méi)有設(shè)想到的功能特性。當(dāng)然我們?cè)陂_(kāi)發(fā)的過(guò)程中也遇到了相當(dāng)多的技術(shù)挑戰(zhàn),最典型的有:
????1.?Implementing?custom??components,?Which???included?a???tree/table?viewer???and?a??query??builder???that??lets????users??dynamically??add???and??remove?fundamental??components?such?as???text????fields?and??drop-down?lists?used??to?build?database?queries.?
????1.?實(shí)現(xiàn)客戶端組件,諸如樹(shù)型、列表的視圖和允許用戶在創(chuàng)建數(shù)據(jù)庫(kù)查詢時(shí)動(dòng)態(tài)的增加和刪除類似于文本輸入框或者下拉列表等基本元素的查詢構(gòu)造器的客戶端組件。
????2.?Supporting?hand-held?devices,?such?as?PDAs?and?radio?frequency?devices.?
????
????2.?支持手持設(shè)備,例如PDA和射頻設(shè)備。
????3.?Lack??of??an??IDE???for??effective??rapid??application???development??(RAD).
????
????3.?缺乏有效的能夠支持快速應(yīng)用開(kāi)發(fā)的集成環(huán)境。
????
????Implementing?custom?components?and?supporting?hand-held??devices—especially??the?latter—consumed??a?great??deal?of??our?time??and?effort.?Also,?although?some??of?the??developers?used??the?Eclipse??open?source??IDE,?we??lacked?an?effective?RAD?tool?for?implementing?the?Web?application's?user?interface.?
????實(shí)現(xiàn)客戶端組件和支持手持設(shè)備消耗了大量的時(shí)間精力。盡管一部分開(kāi)發(fā)人員使用了開(kāi)????放源碼的Eclipse基層開(kāi)發(fā)環(huán)境,但是我們?cè)赪eb應(yīng)用的客戶界面開(kāi)發(fā)方面還是沒(méi)有有效的RAD工具。
????Unless?you've?been?living?in?a?cave?for?the?past?few?years,?I'm?sure??you're??aware?that??tools?exist??for?creating??custom?Web??components?and?supporting??markup?languages?other?than?HTML,?all?of?which?are?wrapped?up?in?a?very?nice?IDE.?That?software,?of?course,?is?Microsoft's?.Net?with?WebForms;?the?IDE?is?Visual?Studio.?
????我確信除非你不韻世事,否則你肯定知道用于開(kāi)發(fā)用戶Web組件和支持HTML以外的標(biāo)記語(yǔ)言的工具已經(jīng)被集成到了一個(gè)非常不錯(cuò)的開(kāi)發(fā)工具中了。當(dāng)然這個(gè)工具就是Microsoft's?.Net?with?WebForms,而這個(gè)開(kāi)發(fā)環(huán)境就是Visual?Studio。
????In??spite?of??those?attractive??.Net?features,??the?company??I?was??working
for—like?many?software?development?companies?nowadays—opted?to?go?with?the?Java??2?Platform,??Enterprise?Edition??(J2EE)?because??of?its??platform?and
vendor?independence??and?the??wealth?of??available?open??source?software?for???Java?and?J2EE.?
????盡管.NET具有很多引人矚目的特性,我所工作的公司和目前的許多軟件開(kāi)發(fā)公司一樣,因?yàn)镴2EE的平臺(tái)無(wú)關(guān)性和大量可以利用的開(kāi)放源碼的軟件而傾向于在J2EE上進(jìn)行開(kāi)發(fā)
????Wouldn't?it??be?nice??if?you??could?take??advantage?of??Java?and?.Net's?best?features,?platform?and?vendor?independence,?open?source?products?such?as?Ant?and?log4j,?and?the?ability?to?easily?create?custom?Web?components?and?render?them?to?multiple?devices,?all?wrapped?up?in?a?killer?IDE??That's?the?promise?of?JavaServer?Faces.?
????如果我們能把所有這些Java和.NET各自的優(yōu)點(diǎn),平臺(tái)無(wú)關(guān)的特性,類似Ant和Log4j這樣優(yōu)秀的開(kāi)放源碼的軟件產(chǎn)品以及能夠簡(jiǎn)便的生成客戶Web組件并發(fā)布到多種設(shè)備上的能力組合到一個(gè)獨(dú)一無(wú)二的集成開(kāi)發(fā)環(huán)境中,那這個(gè)開(kāi)發(fā)環(huán)境將是非常的優(yōu)秀啊?這就是????JSF將提供給我們的東西。
JSF是什么?
????JavaServer?Faces?(JSF)??is?an?application??framework?for?creating??Web-based?user?interfaces.??If?you?are??familiar?with??Struts?(a?popular???open?source?JSP-based?Web??application??framework)??and?Swing???(the?standard?Java??user?interface??framework?for?desktop??applications),??think?of?JavaServer??Faces?as?a??combination?of??those?two??frameworks.?Like??Struts,??JSF?provides?Web?application?lifecycle??management?through??a?controller???servlet;?and??like?Swing,?JSF??provides?a??rich?component??model?complete??with?event??handling?and?component?rendering.?
JSR是生成基于Web的用戶界面的應(yīng)用程序框架。如果你對(duì)Struts(流行的開(kāi)放源碼的Web應(yīng)用程序框架)和Swing(標(biāo)準(zhǔn)的用于桌面應(yīng)用的Java用戶界面框架)都很熟悉的話,可以認(rèn)為JSF是他們二者的集成。類似于Struts,JSF通過(guò)一個(gè)控制器Servlet提供了Web應(yīng)用的生命周期管理;同時(shí)類似于Swing,JSF提供了包括事件處理和組件生成在內(nèi)的豐富的組件模型。
????In?a?nutshell,?JSF?eases?Web-based?application?development?because?it:?
????Lets?you?create?user?interfaces?from?a?set?of?standard,?reusable?server-side?components???Provides??a??set??of???JSP??tags??to??access??those?components?Transparently??saves??state??information??and??repopulates??forms??when?they?redisplay??Provides??a???framework??for???implementing??custom???components??Encapsulates?event?handling?and?component?rendering?so?you?can?use??standard??JSF?components?or?custom?components??to?support?markup?languages?other??than??HTML?Lets?tool?vendors?develop?IDEs?for?a?standard?Web?application?framework
????
簡(jiǎn)單的說(shuō),JSF基于以下的原因簡(jiǎn)化了基于Web的應(yīng)用的開(kāi)發(fā):
◆使你能夠利用一些標(biāo)準(zhǔn)的可重用的服務(wù)器端組件來(lái)創(chuàng)建客戶界面。?
◆提供了一組JSP?標(biāo)簽來(lái)獲取(訪問(wèn))這些組件。?
◆開(kāi)發(fā)人員不用關(guān)心當(dāng)頁(yè)面刷新的時(shí)候頁(yè)面狀態(tài)數(shù)據(jù)的存儲(chǔ)和重現(xiàn)。?
◆提供了一個(gè)用于實(shí)現(xiàn)定制組件的框架?
◆封裝了事件處理和組件顯示,所以你可以使用標(biāo)準(zhǔn)的或者定制的JSF組件支持HTML以外的標(biāo)記語(yǔ)言。
◆開(kāi)發(fā)工具提供商可以開(kāi)發(fā)針對(duì)標(biāo)準(zhǔn)Web應(yīng)用框架的集成環(huán)境。
????Besides?being?a?conceptual?combination?of?Struts?and?Swing,?JSF?is?a??direct?competitor?to?Microsoft's?WebForms.?The?frameworks?are?very?similar,?both?in?concept?and?implementation.?And?because??JSF?represents?a?standard?for??Java-based??Web??application??frameworks,???tool??vendors??can??concentrate???on??developing??IDEs??for??JSF??instead???of??developing??an??IDE??for???one??of?approximately?35?existing??Java-based?Web?application??frameworks,?including?Struts.?
????
除了作為Struts和Swing概念上的統(tǒng)一體外,JSF還將成為Microsoft的WebForms的直接????競(jìng)爭(zhēng)對(duì)手。這兩種框架不論從概念或者實(shí)現(xiàn)上都非常相似。由于JSF作為基于Java的Web????應(yīng)用框架的標(biāo)準(zhǔn),工具開(kāi)發(fā)商們可以專注于為JSF開(kāi)發(fā)集成環(huán)境,而不僅僅為包括Struts在內(nèi)的大約35種基于Java的Web應(yīng)用框架的其中之一開(kāi)發(fā)集成環(huán)境。
????
????Note:?Struts?developers?needn't?worry;?although?JSF?and?Struts?have?much??in?common,?JSF?will?not?make?Struts?obsolete.?See?Resources?for?a?discussion?of?an?integration?strategy?for?Struts?and?JavaServer?Faces.?
????
注:Struts開(kāi)發(fā)人員不用擔(dān)憂;盡管JSF和Struts很相像,但JSF并不會(huì)放棄Struts。在參考資料中有關(guān)于集成兩者的討論。
????Currently,??JSF??is?an??early??access?(EA)??release,??and,?as??a??result,?is?somewhat?immature.?The?specification?leaves?some?functionality??unspecified,?and??the?specification??and?reference??implementation?are??currently?out??of?sync,?with??the?former??specifying?new??syntaxes?and??functionality?not??yet?implemented?in?the?latter.?On?the??other?hand,?JSF?is?mature?enough??for?you?to??write?code??against—although?much??of?that??code?is??guaranteed?to??be?obsolete?(see??the?disclaimer??below)—and?the??reference?implementation??is?fairly??complete??and??relatively???bug-free.??You??can??download???the??JSF?specification,?the?reference?implementation,?two?sample?applications,?and??a?JSF?tutorial?from?Resources.?
????
目前JSF還僅僅是EA版本,所以不是很成熟。規(guī)范當(dāng)中還有很多功能沒(méi)有闡述,規(guī)范和????參考實(shí)現(xiàn)也不同步,規(guī)范中描述的語(yǔ)法和功能還沒(méi)有得到實(shí)現(xiàn)。另一方面,JSF已經(jīng)足夠成熟得讓你根據(jù)它進(jìn)行編程——盡管有些代碼將會(huì)被廢棄(參看下文聲明)——而且參考實(shí)現(xiàn)已經(jīng)基本完成而且比較可靠。你可以從參考資源中下載JSF的規(guī)范、參考實(shí)現(xiàn)、兩個(gè)樣例應(yīng)用和一份JSF教程。
????The?two??articles?in??this?series??provide?a??code-intensive?introduction?to?JavaServer?Faces.?In?this??article,?I?begin?with??a?short?discussion?of??the?JSF??lifecycle??and??then??dive??into??some??example??code??that?illustrates?implementation?of?Web-based??user?interfaces?with??JSF?and?how??you?can?take?advantage?of?built-in??validation.?In?Part??2,?I?will??explain?more?advanced?JSF?concepts?such?as:??implementing?custom?validation;?using??model?objects;?internationalization;?creating??custom?components;??and?finally,??delegating??event?handling?and??rendering?so?you??can?use?components??to?generate?markup?languages?other?than?HTML.?
本系列的兩篇文章提供的是并不偏重編碼的JSF介紹。在本篇中,我在簡(jiǎn)短的介紹了JSF的生命周期以后將通過(guò)一些示例代碼來(lái)說(shuō)明如何通過(guò)JSF來(lái)實(shí)現(xiàn)基于Web的用戶界面以及如何利用內(nèi)建的驗(yàn)證功能。下一篇中,我將闡述一些JSF的高級(jí)概念:實(shí)現(xiàn)定制驗(yàn)證、使用模型對(duì)象、國(guó)際化支持、生成定制組件和便于你使用組件生成HTML以外的標(biāo)記語(yǔ)言的事件的代理和處理機(jī)制。
????Disclaimer:?The?code?discussed?in??this?article?was?written?against??the?EA2?JSF??reference?implementation.??As?mentioned??above,?the??specification?and??reference?implementation?are?in?a?state?of?flux,?and?therefore,?the?code??in??this?article?is?guaranteed?to?be??obsolete?in?the?near?future;?however,??the??code??works?as??advertised?with??the?EA2??reference?implementation??and?was??tested?with?both?Tomcat?4.0.6?(the?latest?production?release?of?Tomcat)??and??Resin?2.1.6.?Furthermore,?you?can?read?the?JSF?specification?until?the??cows?come?home,?but??to?really?grasp??the?concepts,?you??must?ruminate?over??some?code.?
????聲明:本文中的代碼均針對(duì)EA2版本的JSF參考實(shí)現(xiàn)編寫(xiě)。前面已經(jīng)說(shuō)明,規(guī)范和參考實(shí)現(xiàn)目前還在修訂當(dāng)中,這些代碼將很快會(huì)被廢棄;然而這些代碼可以在EA2版本的參考實(shí)現(xiàn)上運(yùn)行,并且在Tomcat?4.0.6和Resin?2.1.6上通過(guò)了測(cè)試。當(dāng)然你也可以研讀規(guī)范直至領(lǐng)會(huì),但是如果你想真正掌握概念,就應(yīng)該做一些深入的編碼實(shí)踐。
JSF的運(yùn)行周期(The?JavaServer?Faces?lifecycle)
????JSF?handles?HTTP?requests?with?seven?distinct?phases,?as?shown?in?Figure??1.??The?normal?flow?of?control?is?shown?with?solid?lines,?whereas??dashed??lines?show?alternate??flows?depending??on??whether??a?component??requests??a??page?redisplay??or?validation??or??conversion?errors?occur.?
????
JSF通過(guò)7個(gè)步驟來(lái)處理一個(gè)HTTP請(qǐng)求,如圖1。正常的處理流程通過(guò)實(shí)線標(biāo)識(shí),虛線表示一些諸如刷新顯示、驗(yàn)證錯(cuò)誤、轉(zhuǎn)換錯(cuò)誤等特殊情況的可選的處理流程。

????The??Reconstitute??Request??Tree??phase?creates??a??component??tree??for?the??requested?page.?If?that?page??previously?displayed?and?JSF?saved??the?page's??state?information,?the?state?information?is?added?to?the?request.?This?means?that?JSF?automatically?retains?form?information?when?a?form?redisplays;??for?example,?when?a?user?does?not?correctly?fill?out?a?form.?This?handy??feature?is??a??fundamental??capability??provided??by??Microsoft's??WebForms,??but?is?otherwise?absent?from?J2EE.?
????
重建請(qǐng)求樹(shù)階段為被請(qǐng)求的頁(yè)面創(chuàng)建組件樹(shù)。如果這個(gè)頁(yè)面曾經(jīng)被訪問(wèn)過(guò),JSF會(huì)保存????上次訪問(wèn)時(shí)的狀態(tài)信息和數(shù)據(jù),在此時(shí)將這些狀態(tài)數(shù)據(jù)加入到當(dāng)前的請(qǐng)求。這意味著當(dāng)重復(fù)訪問(wèn)某個(gè)表單的時(shí)候JSF將自動(dòng)的恢復(fù)表單數(shù)據(jù)。這個(gè)便利的功能在Microsoft的WebForms中是基本功能,但是在J2EE中則被遺漏了。
????During?the?Apply?Request?Values?phase,?the?JSF?implementation?iterates??over?the?components??in?the??component?tree??and?calls??each?component's?decode()??method.?That?method?extracts?information??from?the?request?and?stores??it?in??the?component.?Optionally,?components?may?delegate?decoding?to?a?renderer.?
????
在請(qǐng)求數(shù)據(jù)解析階段中,JSF實(shí)現(xiàn)遍歷組件樹(shù)中所有的組件調(diào)用所有組件的decode()方????法。decode()方法將從請(qǐng)求中提取信息并存儲(chǔ)到組件當(dāng)中。某些情況下,組件可用于為響應(yīng)合成器提取數(shù)據(jù)。
????In?addition?to?decoding?request?information?during?the?Apply?Request??Values??phase,?components?or?their??renderers?may?create?request??events.?Typically,??request??events?signal??a?visual??change?for??one?or??more?components;??for??example,?clicking?on?a?graphic?in?a?tree?control?may?expand?a?branch?of??the??tree.??Alternatively,??an??event??in?one??component??may??update??the?visual??representation?of?another?component;?for?example,?clicking?on?a?leaf?node?in??a?tree?may?cause?an?associated?list?to?change?its?contents?and?redisplay.?In?either?situation,?a?request?event?is?generated?and?added?to?the?JSF?context.?
????
另外在請(qǐng)求數(shù)據(jù)解析階段提取請(qǐng)求信息的過(guò)程中,組件或者他們的響應(yīng)合成器可能會(huì)生成一些請(qǐng)求事件。最典型的有請(qǐng)求事件可能會(huì)觸發(fā)了一個(gè)或多個(gè)組件的顯示變化;例如當(dāng)點(diǎn)擊一個(gè)樹(shù)型控件可能會(huì)展開(kāi)它的分支。另外,某個(gè)組件的事件可能會(huì)更新另一個(gè)組件的顯示;例如當(dāng)點(diǎn)擊一個(gè)樹(shù)型控件的葉節(jié)點(diǎn)可能會(huì)導(dǎo)致和它關(guān)聯(lián)的列表控件改變它的內(nèi)容和顯示。在任何一種情況下,都會(huì)產(chǎn)生一個(gè)請(qǐng)求事件加入到JSF的運(yùn)行環(huán)境中。
????Request?events,?which?are?generated??during?the?Apply?Request?Values??phase,?are??handled??during?the??Handle??Request?Events??phase.??During?the??Handle?Request??Events??phase,??the?JSF??implementation??calls??the?processEvents()??method?for?each??component?that?has??one?or?more??request?events.?Components??may?handle?request?events?themselves,??or?they?may?choose?to??delegate?event?handling?to??an?event??handler.?The??processEvents()?method??is?a??boolean()?method.?If?that?method?returns??false,?lifecycle?processing?advances?to??the?Process?Validations?phase;?otherwise,?lifecycle?processing?advances?directly?to?the?Render?Response?phase.?
請(qǐng)求數(shù)據(jù)解析階段產(chǎn)生的請(qǐng)求事件都在請(qǐng)求事件處理階段處理。在請(qǐng)求事件處理階段JSF實(shí)現(xiàn)為那些有一個(gè)或多個(gè)請(qǐng)求事件的組件調(diào)用processEvents()方法。這些組件將自行處理這些事件或者提交給某個(gè)事件處理器代理處理。processEvents()方法返回值為boolean。如果返回false,處理周期將前進(jìn)到驗(yàn)證處理階段,否則將直接跳轉(zhuǎn)至響應(yīng)合成階段。
????During??the??Reconstitute?Request??Tree??phase,?the??JSF??implementation?may?register?one?or?more?validators?for??any?of?the?components?in?the??component??tree.?In?the?Process?Validations??phase,?the?JSF?implementation?invokes??the?validate()?method?for?each?validator.?Validators?perform?correctness??checks?and?return??a?boolean??value?from??their?validate()??method;?if??that?method?returns??true,??the??JSF?lifecycle??proceeds??normally;??otherwise,?the??JSF?implementation?invokes?the?Render?Response?phase?directly.?
在重建請(qǐng)求樹(shù)階段,JSF實(shí)現(xiàn)會(huì)為請(qǐng)求樹(shù)上的組件注冊(cè)一個(gè)或多個(gè)驗(yàn)證器。在驗(yàn)證處理階段,JSF實(shí)現(xiàn)調(diào)用每一個(gè)驗(yàn)證器的validate()方法。驗(yàn)證器執(zhí)行validate()方法進(jìn)行正確性檢驗(yàn)以后返回一個(gè)boolean值;如果為true,JSF處理周期將繼續(xù)前進(jìn);否則將直接跳轉(zhuǎn)至響應(yīng)合成階段。
????Each?JSF?user?interface?component?can??be?associated?with?a?field?in??a?Java?object?(known?as?a?model??object).?During?the?Update?Model??phase,?component?values??are??copied???to??the??component's???model??object.??A???component's?updateModel()?method?carries?out??that?data?transfer.?Conversion??errors?can?occur?during?this??phase?because?request??parameters?are?strings,??but?model?values?can?represent?any?type?of?Java?object.?If?a?conversion?error??occurs,?the?JSF?implementation?invokes?the?Render?Response?phase?directly.?
????
每一個(gè)JSF用戶界面組件都關(guān)聯(lián)于一個(gè)Java對(duì)象(被稱為模型對(duì)象)的某個(gè)字段。在模型更新階段,組件的值將被復(fù)制到對(duì)應(yīng)的組件當(dāng)中。數(shù)據(jù)傳遞通過(guò)模型對(duì)象的updateModel()方法調(diào)用完成。由于請(qǐng)求參數(shù)都是字符串而模型對(duì)象字段有可能是任何Java對(duì)象類型,如果發(fā)生轉(zhuǎn)換錯(cuò)誤,JSF實(shí)現(xiàn)將直接跳轉(zhuǎn)至響應(yīng)合成階段。
????In?a?JSF?application,?if?you?submit?a?form?or?click?on?a?link?(both?of?which?must?be??represented?by??JSF?components),??the?JSF??implementation?creates?a??form?event?or?a?command?event,?respectively.?Those?events?are?handled?in?the??Invoke??Application??phase?by??an??application-specific?handler.??Typically,??those??handlers??specify?a??URL,??and?the??JSF??implementation?forwards??the?request?to??that?URL.??Currently,?application-specific??handlers?handle?form?and?command?events??in?a?single??method,?typically?with??a?switch?statement.?The?JSF?expert??group?is?aware??of?this?approach's??ugliness,?and?therefore,?it's?almost?certain?to?change?in?the?JavaServer?Faces?1.0?release.?
????
在JSF應(yīng)用中,如果你通過(guò)提交一個(gè)表單或者點(diǎn)擊一個(gè)連接(都需要是通過(guò)JSF組件提供的),JSF實(shí)現(xiàn)將分別生成一個(gè)表單事件和命令事件。這些事件將在調(diào)用Web應(yīng)用階段由一個(gè)應(yīng)用聲明的處理器進(jìn)行處理。典型的情況是處理器聲明了一個(gè)URL,JSF實(shí)現(xiàn)將這個(gè)請(qǐng)求前轉(zhuǎn)到這個(gè)URL中。目前應(yīng)用聲明的處理器對(duì)此的處理都是通過(guò)一個(gè)包含一個(gè)switch語(yǔ)句的單一方法進(jìn)行的。JSF專家組意識(shí)到這樣的方案不是很合理,因此在JSF?1.0的正式發(fā)行版將肯定會(huì)有所改變。
????Finally,?the??Render?Response??phase?creates??a?response??component?tree?and?forwards?the??response.?When??a?user??submits?a??form,?clicks??on?a?link,?or?otherwise?generates?a?request,?the?cycle?starts?anew.?
????
最后,響應(yīng)合成階段生成一個(gè)響應(yīng)組件樹(shù)并發(fā)送響應(yīng)。當(dāng)用戶再次提交一個(gè)表單或點(diǎn)擊一個(gè)鏈接,總之生成一個(gè)請(qǐng)求,那么處理流程將重新開(kāi)始。
????Now?that?we?have??a?general?overview?of??JavaServer?Faces?and?a??rudimentary?understanding?of?the?JSF?lifecycle,?let's?take?a?look?at?some?code.?
現(xiàn)在我們已經(jīng)對(duì)JSF和處理流程有了一個(gè)粗略的認(rèn)識(shí),下面將研究一些代碼。
Seegeris,Bruce
posted on 2005-09-06 22:25 風(fēng) 閱讀(629) 評(píng)論(0) 編輯 收藏