探索與發現

          研究java技術

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            83 隨筆 :: 0 文章 :: 109 評論 :: 0 Trackbacks

          Tiles support


          For better struts/tiles support, myfaces has an integrated JspTilesViewHandler (since release 1.0.6 bate). The main advantage of the ViewHandler is, that tiles-definitions can be sourced out into xml files (up to now using tiles and myfaces you had to definie the layout within jsp-pages).

          Have a look at the tiles-webapp example.

          Steps to implement a myfaces-tiles application:


          1) configure the JspTilesViewHandler in your faces-config:
          <application>
          ???<view-handler>net.sourceforge.myfaces.application.jsp.JspTilesViewHandlerImpl</view-handler>
          </application>

          2) add the following lines to your web.xml
          <context-param>
          ???<param-name>tiles-definitions</param-name>
          ???<param-value>/WEB-INF/tiles.xml</param-value>
          </context-param>

          3) define your layout in a tiles-definition file (sample from the tiles-webapp).

          When rendering the view, the JspTilesViewHandlerImpl will take the given viewId and compute a tileId by
          • substituting any extension by ".tiles"
          • appending ".tiles" if path-mapping is used
          Next the ViewHanlder looks up in the tile-definitions for the corresponding definition.
          (eg. for viewId = /page1.jsp the lookup would be /page1.tiles)

          By the way, the JspTilesViewHandlerImpl is part of the myfaces-components. So someone could use it with Sun's RI too.
          ==================================================================
          <!DOCTYPE tiles-definitions PUBLIC
          ?"-//Apache?Software?Foundation//DTD?Tiles?Configuration//EN"
          ?"http://jakarta.apache.org/struts/dtds/tiles-config.dtd">

          <tiles-definitions>
          ???<definition?name="layout.example"?path="/template/template.jsp"?>
          ???????<put?name="header"?value="/common/header.jsp"?/>
          ???????<put?name="menu"?value="/common/navigation.jsp"?/>
          ???</definition>

          ???<definition?name="/page1.tiles"?extends="layout.example"?>
          ???????<put?name="body"?value="/page1.jsp"?/>
          ???</definition>

          ???<definition?name="/page2.tiles"?extends="layout.example"?>
          ???????<put?name="body"?value="/page2.jsp"?/>
          ???</definition>

          </tiles-definitions>


          http://www.marinschek.com/myfaces/tiki/tiki-index.php?page=Features
          posted on 2006-09-25 05:39 蜘蛛 閱讀(584) 評論(0)  編輯  收藏 所屬分類: jsf

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


          網站導航:
           
          主站蜘蛛池模板: 孟津县| 阳原县| 宣化县| 洛宁县| 张家界市| 永定县| 襄垣县| 嘉定区| 瑞丽市| 天峻县| 江城| 廊坊市| 那曲县| 黔南| 普格县| 漳浦县| 光泽县| 浙江省| 子洲县| 合山市| 大同市| 雷山县| 五常市| 富源县| 嘉兴市| 柞水县| 许昌县| 木里| 高邮市| 茶陵县| 吴桥县| 抚州市| 新邵县| 平顶山市| 青铜峡市| 曲阳县| 岢岚县| 滦南县| 阿勒泰市| 大宁县| 九龙城区|