tomahawk+richfaces+facelets整合

The guidance to configure the myfaces and richfaces

1 Overview

After almost three weeks, the project about myfaces and richfaces compability is success.

I hope this artical will help you save some developing time.

 

2 this project required all .jar list is in the affix

all .jar list

 

 

3 configure the 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>JSF Demo</description>
  <display-name>JSF Demo</display-name>
  <context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config.xml</param-value>
  </context-param>
  
	<context-param>
        <param-name>facelets.LIBRARIES</param-name>
        <param-value>/WEB-INF/facelets/tag/facelets.taglib.xml</param-value>
    </context-param>  
  <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>org.ajax4jsf.SKIN</param-name>
		<param-value>blueSky</param-value>
	</context-param>
  
  <filter>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
    <init-param>
      <param-name>uploadMaxFileSize</param-name>
      <param-value>20m</param-value>
      <description>Set the size limit for uploaded files.
	            Format: 10 - 10 bytes
	                    10k - 10 KB
	                    10m - 10 MB
	                    1g - 1 GB</description>
    </init-param>
  </filter>
  <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages  -->
  <filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
    <servlet-name>Faces Servlet</servlet-name>
  </filter-mapping>
  <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.)  -->
  <filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
  </filter-mapping>
  <filter>
    <display-name>RichFaces Filter</display-name>
    <filter-name>richfaces</filter-name>
    <filter-class>org.ajax4jsf.Filter</filter-class>
    <init-param> 
<param-name>createTempFiles </param-name> 
<param-value>true</param-value> 
</init-param> 
<init-param> 
<param-name>maxRequestSize </param-name> 
<param-value>10000000 </param-value> 
</init-param> 
  </filter>
  <filter-mapping>
    <filter-name>richfaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>FORWARD</dispatcher>

    <dispatcher>REQUEST</dispatcher>
  </filter-mapping>
  <listener>
    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
  </listener>
  <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>*.jsf</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.xhtml</welcome-file>
  </welcome-file-list>
  <login-config>
    <auth-method>BASIC</auth-method>
  </login-config>
  
</web-app>

  4 configure the faces-config.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC
 "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
 "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<faces-config>
		<application>
			<locale-config>
				<default-locale>en</default-locale>
			</locale-config>
			<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
		</application>




</faces-config>

  5 pom.xml config

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.talgroup.myfaces</groupId>
  <artifactId>myfaces_mvn</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>myfaces_mvn Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
	     <dependency>
	    <groupId>org.apache.myfaces.core</groupId>
	    <artifactId>myfaces-impl</artifactId>
	    <version>1.2.5</version>
		</dependency> 
		 <dependency>
		    <groupId>org.apache.myfaces.core</groupId>
		    <artifactId>myfaces-api</artifactId>
		    <version>1.2.5</version>
		</dependency> 
		<dependency>
		    <groupId>org.apache.myfaces.tomahawk</groupId>
		    <artifactId>tomahawk</artifactId>
		    <version>1.1.8</version>
		</dependency> 

		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<version>1.2.1</version>
		</dependency>		
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>1.4</version>
		</dependency>
       <dependency>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
           <version>1.3</version>
        </dependency> 
	    <dependency>
	       <groupId>commons-discovery</groupId>
	       <artifactId>commons-discovery</artifactId>
	       <version>0.4</version>
	     </dependency> 
     	<dependency>
			<groupId>commons-beanutils</groupId>
			<artifactId>commons-beanutils</artifactId>
			<version>1.7.0</version>
		</dependency>
		<dependency>
			<groupId>commons-digester</groupId>
			<artifactId>commons-digester</artifactId>
			<version>1.8</version>
		</dependency>
		<dependency>
			<groupId>commons-collections</groupId>
			<artifactId>commons-collections</artifactId>
			<version>3.2.1</version>
		</dependency>
		<dependency>
            <groupId>commons-lang</groupId>
              <artifactId>commons-lang</artifactId>
            <version>2.1</version>
        </dependency> 
        <dependency>
			<groupId>commons-logging</groupId>
			<artifactId>commons-logging</artifactId>
			<version>1.0.4</version>
			<exclusions>
				<exclusion>
					<groupId>javax.servlet</groupId>
					<artifactId>servlet-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
       <dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
			<version>1.1.2</version>
		</dependency>
		

		<dependency>
			<groupId>commons-logging</groupId>
			<artifactId>commons-logging</artifactId>
			<version>1.0.4</version>
			<exclusions>
				<exclusion>
					<groupId>javax.servlet</groupId>
					<artifactId>servlet-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>com.sun.facelets</groupId>
			<artifactId>jsf-facelets</artifactId>
			<version>1.1.14</version>
			<optional>false</optional>
		</dependency>
		
		<dependency>
			<groupId>javax.el</groupId>
			<artifactId>el-api</artifactId>
			<version>1.0</version>
		</dependency>
		<dependency>
			<groupId>javax.el</groupId>
			<artifactId>el-ri</artifactId>
			<version>1.2</version>
		</dependency>
	
		<dependency>
			<groupId>org.richfaces.framework</groupId>
			<artifactId>richfaces-impl</artifactId>
			<version>3.2.2.GA</version>
		</dependency>
		<dependency>
			<artifactId>richfaces-api</artifactId>
			<groupId>org.richfaces.framework</groupId>
			<version>3.2.2.GA</version>
		</dependency>
		<dependency>
			<groupId>org.richfaces.ui</groupId>
			<artifactId>richfaces-ui</artifactId>
			<version>3.2.2.GA</version>
		</dependency>		
  </dependencies>
  <build>
    <finalName>myfaces_mvn</finalName>
   		<defaultGoal>package</defaultGoal>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.5</source>
					<target>1.5</target>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<configuration>
					<artifactItems>
						<artifactItem>
							<groupId>${project.groupId}</groupId>
							<artifactId>
								${project.artifactId}
							</artifactId>
							<version>${project.version}</version>
							<type>${project.packaging}</type>
							<overWrite>true</overWrite>
							<outputDirectory>
								${artifactsDir}
							</outputDirectory>
						</artifactItem>
					</artifactItems>
				</configuration>
			</plugin>
		</plugins>
  </build>
  <distributionManagement>
		<repository>
			<id>releases</id>
			<url>
				dav:http://192.168.106.129:28080/artifactory/libs-releases
			</url>
		</repository>

	</distributionManagement>
</project>
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值