转自:http://www.cnblogs.com/phoenixup/articles/575124.html
.web.xml配置<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp_ID">
<context-param>
<!-- Faces Context Configuration -->
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/config/faces-config.xml</param-value>
</context-param>
<!-- Tomahawk TLD文件配置--> <context-param>
<param-name>facelets.LIBRARIES</param-name>
<param-value>/WEB-INF/tld/tomahawk.taglib.xml</param-value>
</context-param>
<!-- 视图文件的后缀解析配置 --> <context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.html</param-value>
</context-param>
<!-- Tomanawk ExtensionsFilter的配置 -->
<filter>
<filter-name>extensionsFilter</filter-name>
<filter-class>
org.apache.myfaces.webapp.filter.ExtensionsFilter
</filter-class>
<init-param>
<param-name>maxFileSize</param-name>
<param-value>10m</param-value>
</init-param>
</filter>
<!-- ExtensionsFilter的配置
<filter-mapping> <filter-name>extensionsFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
如果不使用Facelets,需要配置此项-->
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>*.page</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.page</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
这是最简要的配置。
2。faces-config.xml配置<application>
<!--增加Facelet视图处理器 -->
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler> <message-bundle>resources.application</message-bundle>
<locale-config>
<default-locale>zh_CN</default-locale>
</locale-config>
</application>
3.tomahawk.taglib.xml文件
在WEB-INF/tld目录下增加tomahawk.taglib.xml文件<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
<facelet-taglib>
<namespace>http://myfaces.apache.org/tomahawk</namespace>
<tag>
<tag-name>aliasBean</tag-name>
<component>
<component-type>
org.apache.myfaces.AliasBean
</component-type>
<renderer-type>org.apache.myfaces.AliasBean</renderer-type>
</component>
</tag>
<tag>
<tag-name>buffer</tag-name>
<component>
<component-type>org.apache.myfaces.Buffer</component-type>
<renderer-type>org.apache.myfaces.Buffer</renderer-type>
</component>
</tag>
<tag>
<tag-name>columns</tag-name>
<component>
<component-type>
org.apache.myfaces.HtmlColumns
</component-type>
</component>
</tag>
<tag>
<tag-name>column</tag-name>
<component>
<component-type>
org.apache.myfaces.HtmlColumn
</component-type>
</component>
</tag>
<tag>
<tag-name>commandButton</tag-name>
<component>
<component-type>
org.apache.myfaces.HtmlCommandButton
</component-type>
</component>
</tag>
<tag>
<tag-name>commandLink</tag-name>
<component>
<component-type>
org.apache.myfaces.HtmlCommandLink
</component-type>
</component>
</tag>
<tag>
<tag-name>commandNavigation</tag-name>
<component>
<component-type>
org.apache.myfaces.HtmlCommandNavigation
</component-type>
<renderer-type>javax.faces.Link</renderer-type>
</component>
</tag>
<tag>
<tag-name>commandSortHeader</tag-name>
<component>
<component-type>
org.apache.myfaces.HtmlCommandSortHeader
</component-type>
<renderer-type>org.apache.myfaces.SortHeader</renderer-type>
</component>
</tag>
<tag>
<tag-name>dataList</tag-name>
<component>
<component-type>
org.apache.myfaces.HtmlDataList
</component-type>
<renderer-type>org.apache.myfaces.List</renderer-type>
</component>
</tag>
<tag>
<tag-name>dataScroller</tag-name>
<component>
<component-type>
org.apache.myfaces.HtmlDataScroller
</component-type>
<renderer-type>
org.apache.myfaces.DataScroller
</renderer-type>
</component>
</tag>
<tag>
<tag-name>dataTable</tag-name>
<component>
<component-type>
org.apache.myfaces.HtmlDataTable
</component-type>
<renderer-type>org.apache.myfaces.Table</renderer-type>
</component>
</tag>
<tag>