在Tomahawk成功部署后,出于對(duì)界面的優(yōu)化和增加一些功能亮點(diǎn)的需要,我開(kāi)始考慮使用一些sandbox中的控件,本來(lái)按理說(shuō)一切都應(yīng)該很順利的,畢竟在此之前大部分問(wèn)題都已經(jīng)按部就班地做過(guò)了一遍,所有要改動(dòng)的東西、以及哪些部分是做什么用的都已經(jīng)清楚了,但結(jié)果還是出乎我的意料。

              先說(shuō)說(shuō)這個(gè)意外的結(jié)果吧,含sandbox 組件的頁(yè)面能夠顯示但沒(méi)有相應(yīng)的效果,sandbox的組件看起來(lái)好像被忽略了,查看html源碼可知很多sandbox標(biāo)簽沒(méi)有被正確解析,另外沒(méi)有任何錯(cuò)誤或警告信息,無(wú)論在頁(yè)面還是在log中都沒(méi)有發(fā)現(xiàn)任何有用線索,額外加用facestrace也沒(méi)找到什么錯(cuò)誤。

              配置步驟如下:
              1. 下載tomahawk-sandbox包,我先后試過(guò)兩個(gè)版本:1.1.5   和 1.1.6-snapshot
              2. 下載了facelets主站上的sandbox taglib文件,并且根據(jù)sandbox源碼仔細(xì)核對(duì)修改過(guò),確信沒(méi)有了錯(cuò)誤。
              3. 修改web.xml,在context-param 中為facelets.LIBRARIES,增加了相應(yīng)的taglib.xml,最終信息像下面這樣
           <context-param>
            
          <param-name>facelets.LIBRARIES</param-name>
            
          <param-value>/WEB-INF/tomahawk.taglib.xml;/WEB-INF/sandbox.taglib.xml;/WEB-INF/jsf-comp-chart.taglib.xml;/WEB-INF/facestrace.taglib.xml</param-value>
           
          </context-param>
              以上配置中,除了sandbox,其他一切正常,另外還用了Ajax4JSF,但不管是否去掉它,對(duì)結(jié)果都沒(méi)有影響,已試驗(yàn)過(guò),不必再考慮這個(gè)因素。

              4. 在測(cè)試頁(yè)面中增加了namespace支持,加了點(diǎn)代碼用到sandbox, 片斷如下:

          <t:document       xmlns:t="http://myfaces.apache.org/tomahawk"
               xmlns:s
          ="http://myfaces.apache.org/sandbox"
          ..
          >
          <!-- effect by dojo -->
          <s:effect id="effect1" fade="true">
          <h:outputText value="Hello We hope you enjoy Apache MyFaces and the effects by DOJO and script.aculo.us" />
          </s:effect>
          <!--  input focus -->
          <h:panelGrid columns="2">
             
          <h:outputLabel for="input1" value="Input1: "/>
             
          <h:inputText id="input1"/>
             
          <h:outputLabel for="input2" value="Input2: "/>
             
          <h:inputText id="input2"/>
             
          <s:focus id="focus" for="input2" />
          </h:panelGrid>
          <!--  input suggest -->
          <s:inputSuggest value="#{user.state.key}" required="true">
             
          <f:selectItems value="#{choices}"/>
          </s:inputSuggest>

              5.并且在加入sandbox后,把以前的tomahawk-facelets.jar也從/WEB-INF/lib目錄下刪除試過(guò),不刪除時(shí)有沖突提示,但就sandbox控件的顯示而言,結(jié)果是一樣的,“沒(méi)有!”

          有誰(shuí)能有比較好的解決方案,還是我漏掉了什么重要的步驟,請(qǐng)不吝指教,非常感謝!

          另,希望上述這些配置方法對(duì)需要進(jìn)行tomahawk,facestrace, jsf-comp在facelets中配置的人有些幫助!

          問(wèn)題找到了,因?yàn)閟andbox.taglib.xml中有錯(cuò)誤,導(dǎo)致faceletViewHandler.initializeCompiler失敗,從而使用xmlns:s="http://myfaces.apache.org/sandbox能被識(shí)別,但里面的TagLibConfig卻沒(méi)有正確的內(nèi)容,這樣facelet只好把部分標(biāo)簽忽略了

          Feedback

          # re: 求教: 如何在Facelets中使用Tomhawk sandbox?  回復(fù)  更多評(píng)論   

          2007-06-04 11:23 by 小李飛刀
          在 facelets.dev.java.net(https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib-use-normal)上有這么一段話

          If there is a tag in your document under a namespace (such as XHTML) that isn't specified in a Tag Library, then Facelets will treat that tag as a simple text fragment and optimize it for tree creation. If the namespace is known, but the element's name isn't included in the tag library, then an exception will be thrown which will tell you what file and line caused the problem.

          If your tag or component isn't showing up in your rendered page, check the source of page and see if the tag was simply ignored. This usually means you are using the wrong namespace for your library.

          從癥狀上來(lái)看,的確是把sandbox的tag當(dāng)作了simple text直接輸出到了頁(yè)面,但我就是沒(méi)弄明白為什么會(huì)這樣,仔細(xì)檢查了namespace 和library,好像也沒(méi)發(fā)現(xiàn)什么錯(cuò)誤。

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           

          posts - 44, comments - 43, trackbacks - 0, articles - 5

          Copyright © 小李飛刀

          涉足江湖,廣交朋友
          尋找有共同興趣愛(ài)好者一起開(kāi)創(chuàng)掌上移動(dòng)應(yīng)用!


          歡迎光臨!您是第 hit counter 位訪客。
          主站蜘蛛池模板: 玉环县| 闽侯县| 东方市| 九江市| 奉化市| 和政县| 嵊泗县| 宁津县| 房产| 云梦县| 新和县| 松江区| 溧阳市| 海阳市| 马尔康县| 昆明市| 江川县| 揭阳市| 玉山县| 涞水县| 大港区| 什邡市| 电白县| 敖汉旗| 阳西县| 桐庐县| 拉萨市| 辽宁省| 巴林左旗| 临澧县| 辽阳县| 深圳市| 额尔古纳市| 延庆县| 淄博市| 韶关市| 郴州市| 堆龙德庆县| 准格尔旗| 莱芜市| 龙川县|