﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-探索与发现-随笔分类-jsf</title><link>http://www.blogjava.net/zhaijianhui/category/15184.html</link><description>研究java技术</description><language>zh-cn</language><lastBuildDate>Fri, 09 Mar 2007 11:07:42 GMT</lastBuildDate><pubDate>Fri, 09 Mar 2007 11:07:42 GMT</pubDate><ttl>60</ttl><item><title>Tiles support in MyFaces </title><link>http://www.blogjava.net/zhaijianhui/archive/2006/09/25/71629.html</link><dc:creator>蜘蛛</dc:creator><author>蜘蛛</author><pubDate>Sun, 24 Sep 2006 21:39:00 GMT</pubDate><guid>http://www.blogjava.net/zhaijianhui/archive/2006/09/25/71629.html</guid><wfw:comment>http://www.blogjava.net/zhaijianhui/comments/71629.html</wfw:comment><comments>http://www.blogjava.net/zhaijianhui/archive/2006/09/25/71629.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zhaijianhui/comments/commentRss/71629.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhaijianhui/services/trackbacks/71629.html</trackback:ping><description><![CDATA[
		<h1>Tiles support </h1>
		<br />For better <a class="wiki" href="http://struts.apache.org/" target="_blank">struts/tiles</a> 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). <br /><br />Have a look at the tiles-webapp example. <br /><br /><h2>Steps to implement a myfaces-tiles application: </h2><br />1) configure the JspTilesViewHandler in your faces-config: <br />&lt;application&gt; <br /><font face="courier" size="2">   &lt;view-handler&gt;net.sourceforge.myfaces.application.jsp.JspTilesViewHandlerImpl&lt;/view-handler&gt; </font><br />&lt;/application&gt; <br /><br />2) add the following lines to your web.xml <br />&lt;context-param&gt; <br /><font face="courier" size="2">   &lt;param-name&gt;tiles-definitions&lt;/param-name&gt; </font><br /><font face="courier" size="2">   &lt;param-value&gt;/WEB-INF/tiles.xml&lt;/param-value&gt; </font><br />&lt;/context-param&gt; <br /><br />3) define your layout in a tiles-definition file (<a class="wiki" title="no description" href="http://www.marinschek.com/myfaces/tiki/tiki-index.php?page=TilesSampleXml">sample</a> from the tiles-webapp). <br /><br />When rendering the view, the JspTilesViewHandlerImpl will take the given viewId and compute a tileId by <br /><ul><li>substituting any extension by ".tiles" 
</li><li>appending ".tiles" if path-mapping is used </li></ul>Next the ViewHanlder looks up in the tile-definitions for the corresponding definition. <br />(eg. for viewId = /page1.jsp the lookup would be /page1.tiles) <br /><br />By the way, the JspTilesViewHandlerImpl is part of the myfaces-components. So someone could use it with Sun's RI too. <br />==================================================================<br />&lt;!DOCTYPE tiles-definitions PUBLIC <br /><font face="courier" size="2"> "-//Apache Software Foundation//DTD Tiles Configuration//EN" </font><br /><font face="courier" size="2"> "http://jakarta.apache.org/struts/dtds/tiles-config.dtd"&gt; </font><br /><br />&lt;tiles-definitions&gt; <br /><font face="courier" size="2">   &lt;definition name="layout.example" path="/template/template.jsp" &gt; </font><br /><font face="courier" size="2">       &lt;put name="header" value="/common/header.jsp" /&gt; </font><br /><font face="courier" size="2">       &lt;put name="menu" value="/common/navigation.jsp" /&gt; </font><br /><font face="courier" size="2">   &lt;/definition&gt; </font><br /><br /><font face="courier" size="2">   &lt;definition name="/page1.tiles" extends="layout.example" &gt; </font><br /><font face="courier" size="2">       &lt;put name="body" value="/page1.jsp" /&gt; </font><br /><font face="courier" size="2">   &lt;/definition&gt; </font><br /><br /><font face="courier" size="2">   &lt;definition name="/page2.tiles" extends="layout.example" &gt; </font><br /><font face="courier" size="2">       &lt;put name="body" value="/page2.jsp" /&gt; </font><br /><font face="courier" size="2">   &lt;/definition&gt; </font><br /><br />&lt;/tiles-definitions&gt; <br /><br /><br /><a href="http://www.marinschek.com/myfaces/tiki/tiki-index.php?page=Features">http://www.marinschek.com/myfaces/tiki/tiki-index.php?page=Features</a><img src ="http://www.blogjava.net/zhaijianhui/aggbug/71629.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhaijianhui/" target="_blank">蜘蛛</a> 2006-09-25 05:39 <a href="http://www.blogjava.net/zhaijianhui/archive/2006/09/25/71629.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>