2011-03-15 52 views
2

想用Primefaces使用Spring Web Flow开始一个项目。我需要使用彗星,所以我认为Primefaces使用大气。我对Atmosphere/Comet业务并不是很有经验,所以我们欢迎任何关于从哪里开始的指导。Spring Webflow,带彗星的Primefaces(大气)

由于提前

回答

2

一个非常简单的例子可以在primefaces找到展示:https://www.primefaces.org/showcase/push/chat.xhtml 这是阿贾克斯推成分老例子,是不是正式列入节目的情况下,因为现在它会如果我知道的话,在primefaces 3中重做。此外,你必须到你的web.xml中配置彗星的servlet:

<servlet> 
    <servlet-name>Comet Servlet</servlet-name> 
    <servlet-class>org.primefaces.comet.PrimeFacesCometServlet</servlet-class> 
    <init-param> 
     <param-name>org.atmosphere.useBlocking</param-name> 
     <param-value>true</param-value> 
    </init-param> 
    <load-on-startup>0</load-on-startup> 
</servlet> 
<servlet-mapping> 
    <servlet-name>Comet Servlet</servlet-name> 
    <url-pattern>/primefaces_comet/*</url-pattern> 
</servlet-mapping> 

如果使用primefaces 2.2不能使用大气/彗星的最新版本,我认为。我得到了它具有以下依存关系正在运行:

<dependency> 
     <groupId>org.atmosphere</groupId> 
     <artifactId>atmosphere-runtime</artifactId> 
     <version>0.5</version> 
    </dependency> 
    <dependency> 
     <groupId>org.atmosphere</groupId> 
     <artifactId>atmosphere-compat-tomcat</artifactId> 
     <version>0.5</version> 
    </dependency> 

的最后一步是添加一个名为“atmosphere.xml”你的META-INF目录中包含以下内容的文件:

<?xml version="1.0" encoding="UTF-8"?> 

<atmosphere-handlers> 
    <atmosphere-handler context-root="/primefaces_comet/*" class- name="org.primefaces.comet.PrimeFacesCometHandler" /> 
</atmosphere-handlers> 

+0

谢谢,非常非常有帮助 – add9 2011-03-21 07:53:29