打破神話

          Posted on 2005-10-08 12:13 BlueO2 閱讀(406) 評論(0)  編輯  收藏 所屬分類: MVC Framework
          我什么時候也起這么惡心的題目了,可能和某些同志混久了,也喜歡抓眼球了。言歸正傳,banq老爺子(這么叫挺可愛的),就是jdon創始的那個banq,其實我一直有些佩服有些BS的復雜情緒看待這樣一個人,banq技術上確實有幾下,起碼不是只會吵架的人,能研究些東西,但是,看他吵架和寫東西確實不是很舒服,總是感覺什么東西都是他banq的最好,他的jdonframework比spring先進阿,HiveMind框架的思想他早就有啊之類的……翻翻帖子,看看gigix robbin怎么和banq結的梁子,有時候不禁噴飯。但是似乎所有大牛都有個特點,什么東西都要評頭品足,我就納悶,世界上有這樣的人么?什么東西都研究的明明白白的。今天好不容易閑了,去jdon看看熱鬧,看有人吵架每(這心里夠bt),結果看到banq解答的struts問題的帖子,sigh,要是普通人我早就反駁了,可是因為是banq,我又再次翻出來以前看的資料和源碼才敢指出:banq,u r wrong.而且是很基礎的很本質的錯誤。問題如下:
          感覺Struts標簽太繁瑣了,想用 struts+velocity ,但是頁面如果沒有html:form等struts標簽,頁面的form elements 是否能賦值到formbean中,formbean中的validate方法是否還有效。
          banq的理解:
          當然不會有效。每個字段實際是通過:
          <html:text name="ACTIONFORM名稱" propert=""
          其中name很重要,指定了使用哪個ActionForm。
          俺給個解答,也請指出不足和理解上的偏頗:
          name:The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized.
          Any JavaBean can be used with the Struts JSP tags to populate a control. But to provide automatic validation of the input, Struts uses its own JavaBean subclass,called the ActionForm.
          The ActionForm solution
          The Struts solution to HTTP parameter handling is to transform the input fields into JavaBean properties. When a property on the ActionForm matches a parameter in the request, the framework automatically sets the property to the value of the parameter. A Struts developer can work with a trusty JavaBean and leave the HTTP rigmarole to the framework.To harvest request parameters, all the Struts developer needs to do is provide an ActionForm with JavaBean properties that match the names of the HTTP parameters. The rest is automatic.

          具體如何automatic解析,ActionForm如何被控制,有空再寫,畢竟struts研究的系列心得才進行了很少篇blog,現在忙著webwork2 hibernate spring

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          posts - 29, comments - 3, trackbacks - 0, articles - 0

          Copyright © BlueO2

          主站蜘蛛池模板: 清河县| 噶尔县| 搜索| 安国市| 武定县| 松桃| 同江市| 肥城市| 比如县| 河津市| 山东省| 亳州市| 苍南县| 房山区| 东方市| 无棣县| 饶阳县| 贡觉县| 林甸县| 水城县| 庐江县| 乌兰察布市| 钟山县| 盘锦市| 岳池县| 宜黄县| 三穗县| 喀什市| 太仓市| 天长市| 胶南市| 水城县| 富蕴县| 奈曼旗| 西乌珠穆沁旗| 襄城县| 彭州市| 枣庄市| 盖州市| 贺兰县| 西贡区|