鐵手劍譜

          上善若水

          公告

          天下皆知美之為美,斯惡已;皆知善之為善,斯不善已。 故有無相生,難易相成,長短相形,高下相傾,音聲相和,前后相隨,恒也。
          <2005年8月>
          31123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          統(tǒng)計(jì)

          • 隨筆 - 127
          • 文章 - 1
          • 評(píng)論 - 952
          • 引用 - 26

          常用鏈接

          留言簿(49)

          隨筆分類(201)

          隨筆檔案(127)

          文章分類(1)

          文章檔案(1)

          DotNET

          Java站點(diǎn)

          我的其他空間

          朋友

          著名牛人

          搜索

          •  

          積分與排名

          • 積分 - 400813
          • 排名 - 140

          最新隨筆

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          《Struts in Action》中文修訂版 第14章
          最近忙于修訂《Javaserver Faces in Action》,都沒有時(shí)間來修改這個(gè)文檔了。我發(fā)現(xiàn)校對(duì)文稿真的是一個(gè)非常辛苦的事情,比起寫來,要麻煩得多。何況我又不是一個(gè)細(xì)致的人。真是有些痛苦。今天抽點(diǎn)時(shí)間來繼續(xù)將這部分發(fā)點(diǎn)出來。

          很多人都問,Struts中用什么處理模型和數(shù)據(jù)。

          我以前總說,這和Struts有什么關(guān)系?
          從實(shí)際上來說,這的確和他沒什么關(guān)系,因?yàn)樗荕中立的。你可以使用你自己喜歡的任何M實(shí)現(xiàn)。但是正因如此,其實(shí)也還是和她有關(guān)系的,那就是它本質(zhì)上的MVC的分層設(shè)計(jì)。

          對(duì)Struts本身來說,作為最成功的一個(gè)MVC框架,實(shí)際上其最成功之處和精彩之處就是其中的C,即它是一個(gè)比較好的Front Controller 模式的實(shí)現(xiàn)。 很多地方,特別是其它利用了它的大型框架,都利用了他的這個(gè)優(yōu)點(diǎn)。比如Oracle 的ADF。

          但是對(duì)小型應(yīng)用來說,很多人在爭論,Action到底是M還是C。其實(shí)這并不重要,如果應(yīng)用小型,你盡管可以在其中實(shí)現(xiàn)你的Biz Logic。這樣的話,它就是M。否則,稍大型一些的應(yīng)用,最好還是作為一個(gè)C來使用,至少是C的一個(gè)helper。

          那么,具體的M怎么辦呢?常規(guī)的做法是委托給POJO或者EJB。但是基于分層的目的,這中間通常是需要一個(gè)緩沖,那就是Facade。SUN的 官方Facade實(shí)現(xiàn)原來推薦的是Session EJB,這感情好,如果你能搞定它,業(yè)務(wù)和實(shí)體也可以盡管使用EJB。如果你不能負(fù)擔(dān)EJB之痛,你可以使用POJO Facade來訪問你的POJO實(shí)現(xiàn)的邏輯。

          那么你的POJO生長在哪里?目前的Spring 等IoC容器正是一個(gè)好地方。實(shí)際上我想將Spring 成為是“框架之框架”。
          OK,那么數(shù)據(jù)層又如何?嘿嘿,實(shí)際上離Struts太遠(yuǎn)啦,嚴(yán)格說起來他不想知道,也不用知道。你可以使用任何需要的持久實(shí)現(xiàn),關(guān)鍵是作為DTO傳遞給C和V的結(jié)果,以及它們之間的轉(zhuǎn)換。

          本書中的ProcessBean是早期的一個(gè)POJO Facade,非常不錯(cuò)。但是不知為和這個(gè)包一直在Apache Commons的沙坑中跳不出來。而且如今有些陳舊了。
          不過,本章其中的RSS和Lucene的講述倒是不錯(cuò)。值得參考。

          這里下載

          posted on 2005-08-17 17:24 鐵手 閱讀(1694) 評(píng)論(6)  編輯  收藏 所屬分類: JavaStruts系列

          評(píng)論

          # re: 《Struts in Action》中文修訂版 第14章 2005-08-17 18:21 CALM

          Javaserver Faces in Action 什么時(shí)候可以看到呀?

          # re: 《Struts in Action》中文修訂版 第14章 2005-08-18 10:17 keith

          對(duì),希望Javaserver Faces in Action 快點(diǎn)出來。
          其實(shí)也沒有必要全部弄好再放上來,可以一章一章的放上來
          支持!!!!!!!!

          # re: 《Struts in Action》中文修訂版 第14章 2005-08-18 16:40 happyrabbit

          都說mvc把做可以把做頁面和邏輯的人員分開,我覺得達(dá)不到啊.
          反而增加了做頁面的人員難度.要實(shí)現(xiàn)完全的分離還要些日子

          # re: 《Struts in Action》中文修訂版 第14章 2005-08-20 20:35 tom

          Javaserver Faces in Action 是不是已經(jīng)有孫勇的出版了?

          # Struts in action is a 3.5 star book on Amazon.com,we got some better 2005-08-21 15:21 meji

          I had been reading Struts in Action for quite a while,but finally i couldn't help diversing from it.

          I read the English version and the Chinese version simultaneously,for 5 chapters,i suffered all the way since chapter 2.

          The 1st chapter is quite straightforward on telling you what struts is,illustrating the struts is quite simple and easily understand.

          But the following chapters are somehow too much detailed in literal arts,but only handful of code snippets were given to back the subjects.

          Details sometimes are great but not for the beginners without detailed source code or real-live project. source snippets are just not bearly enough.


          Considering,the book is too detailed to beginners,without complete srccode,hard to have an overall concept not mentioning learning struts.

          the book is better for whom has familiar with struts at the 1st point and want some internal think of the struts.



          # Suggesting "Struts:The Complete Reference" 2005-08-21 15:33 meji

          after i realized the book is sucks to me,i decided to look for a better one...
          Actually there's no 4+ stars book about STRUTS on the Amazon.com

          but we have two 4 stars books that are better than the 3.5 one (Struts in action)
          and well commented on that site.
          namely Struts:
          The Complete Reference" published by MH,

          and

          "Struts for dummies" by AW,

          the latter one is written in American Slang,so if you only familiar with regular English please do not plunge in that.

          While the former one here,is quite a good one and is well recieved too,only written in a good phrased English,which has straightforward illustrations of the Struts and with a consisten example from the begninning to the end,with the complete example you will easily understand how to make use of struts to gain an easy way on web development....

          主站蜘蛛池模板: 于田县| 乐安县| 和政县| 永顺县| 安康市| 乾安县| 习水县| 南和县| 高州市| 唐山市| 北安市| 西华县| 盐源县| 福贡县| 客服| 承德市| 新营市| 兰西县| 佳木斯市| 烟台市| 扎赉特旗| 海兴县| 平塘县| 伊川县| 库伦旗| 千阳县| 淅川县| 大宁县| 江北区| 壶关县| 柳州市| 宁陕县| 明光市| 澄江县| 本溪市| 黄山市| 石门县| 南郑县| 双辽市| 武义县| 怀集县|