日期:2014-05-16  浏览次数:20483 次

使用Eclipse 开发 Richfaces3.3.3 Final+jsf2.0 的基本配置
首先,需要下载最新的Eclipse3.6 helio 因为 Galieo 版对.xhtml模板支持不是很好,而JSF2.0的界面使用Facelets 。下载了Helio后新建立Dynamic Web Project 接着修改web.xml
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 
	<description>Richfaces Components demo</description>
	<display-name>richfaces-demo</display-name>
	<context-param>
		<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
		<param-value>.xhtml</param-value>
	</context-param>
	<context-param>
		<param-name>facelets.REFRESH_PERIOD</param-name>
		<param-value>2</param-value>
	</context-param>
	<context-param>
		<param-name>facelets.DEVELOPMENT</param-name>
		<param-value>true</param-value>
	</context-param>
	<context-param>
		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
		<param-value>server</param-value>
	</context-param>
	<context-param>
		<param-name>com.sun.faces.validateXml</param-name>
		<param-value>true</param-value>
	</context-param>
	<context-param>
		<param-name>com.sun.faces.verifyObjects</param-name>
		<param-value>false</param-value>
	</context-param>
	<context-param>
		<param-name>org.ajax4jsf.SKIN</param-name>
		<param-value>blueSky</param-value>
	</context-param>
	
	<context-param>
		<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
		<param-value>true</param-value>
	</context-param>
	<context-param>
		<param-name>org.ajax4jsf.COMPRESS_STYLE</param-name>
		<param-value>true</param-value>
	</context-param>
	<context-param>
		<param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
		<param-value>NEKO, TIDY</param-value>
	</context-param>
	<context-param>
		<param-name>org.richfaces.CONTROL_SKINNING</param-name>
		<param-value>enable</param-value>
	</context-param>
	<context-param>
		<param-name>org.richfaces.LoadStyleStrategy</param-name>
		<param-value>ALL</param-value>
	</context-param>
	<context-param>
		<param-name>org.richfaces.LoadScriptStrategy</param-name>
		<param-value>ALL</param-value>
	</context-param>
	<context-param>
		<param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
		<param-value>true</param-value>
	</context-param>
	 <context-param>
		<param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name> 
		<param-value>true</param-value> 	
	 </context-param> 
	

	<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>*.xhtml</url-pattern> 
	</servlet-mapping>
	<login-config>
		<auth-method>BASIC</auth-method>
	</login-config>
</web-app>

注意
<context-param>
		<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
		<param-value>com.sun.facelets.FaceletViewHandler</param-value>
	</context-param>

是不需要的。
RichFaces 3.3.3 does not support JSF 2 built-in facelets (VDL)
Facelets 1.1.15 should still be used because of dependencies in RichFaces from the Tag Handlers classes.
RichFaces 3.3