2011-03-15 33 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