[jboss-user] [JBoss Seam] - ajax4js and seam integration - my guide

Holger Prause do-not-reply at jboss.com
Wed Jul 12 22:49:02 EDT 2006


Hello,

after spending 3 days with trying to integrate ajax framworks with jboss seam i finally get a integration with ajax4jsf working

1) first download ajax4js https://ajax4jsf.dev.java.net/nonav/ajax/ajax-jsf/

2) copy the following jars to  $JBOSSSERVERHOME/default/lib

el-api.jar
el-ri.jar
jsf-facelets.jar
ajax4jsf.jar
oscache-2.2.jar

this has to be done becourse of a global JBoss Classloader Issue (cant find the the posting i found for that, i am sorry) , when i deployed these jars with my application i got a lot of problems, well u can try out maybe u get it working.

Also make sure sure the jars mentionend above are not deployed with your application!

3)

change web.xml to and make sure no application view handler is defined.


  | <?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>
  | 	<lifecycle>
  | 	    <phase-listener>
  | 	        org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener
  | 	    </phase-listener>
  | 	</lifecycle>
  | 
  | </faces-config>
  | 


change faces-config.xml to

  | web-app version="2.4" 
  |     xmlns="http://java.sun.com/xml/ns/j2ee"
  |     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  | 
  |     <!-- Seam -->
  |     <listener>
  |         <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
  |     </listener>
  | 
  |     <!-- Propagate conversations across redirects -->
  |     <filter>
  |         <filter-name>Seam Redirect Filter</filter-name>
  |         <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
  |     </filter>
  |     
  |     <!--  ajax4jsf -->
  |     <filter>
  |         <display-name>Ajax4jsf Filter</display-name>
  |         <filter-name>ajax4jsf</filter-name>
  |         <filter-class>org.ajax4jsf.Filter</filter-class>
  |     </filter>
  |     <filter-mapping>
  |        <filter-name>ajax4jsf</filter-name>
  |        <url-pattern>*.seam</url-pattern>
  |     </filter-mapping>
  | 
  | 
  |     
  |     <filter-mapping>
  |         <filter-name>Seam Redirect Filter</filter-name>
  |         <url-pattern>*.seam</url-pattern>
  |     </filter-mapping>
  |     
  |     <filter>
  | 	    <filter-name>Seam Exception Filter</filter-name>
  | 	    <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
  | 	</filter>
  | 
  | 	<filter-mapping>
  | 	    <filter-name>Seam Exception Filter</filter-name>
  | 	    <url-pattern>*.jsf</url-pattern>
  | 	</filter-mapping>
  | 	
  | 
  |     <!-- JSF --> 
  |      <context-param>
  |   		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  |   		<param-value>client</param-value>
  |  	</context-param>   
  |     <context-param>
  | 		<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
  | 		<param-value>com.sun.facelets.FaceletViewHandler</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>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>true</param-value>
  | 	</context-param>
  | 	<context-param>
  | 		<param-name>org.ajax4jsf.SKIN</param-name>
  | 		<param-value>DEFAULT</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>
  | 
  |     <!-- Faces Servlet Mapping -->
  |     <servlet-mapping>
  |         <servlet-name>Faces Servlet</servlet-name>
  |         <url-pattern>*.seam</url-pattern>
  |     </servlet-mapping>
  | 
  |     <!-- MyFaces -->
  |     <listener>
  |         <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
  |     </listener>    
  | </web-app>
  | 
  | 


4) if u have a have any h:commandLink with parameters (f:param)
   replace them with a4j:commandLink or the parameter will get lost

It works good for me even conversations seems (what a wordplay) to work.

Thats it, well its only a temporary guide until maybe some of the jboss crew can give a more detailed and better solution, hopefully its integrated in the next release :-)  (copying the jars in the servers /default/lib directory really gives me a bad taste)

Hope i could help someone,

Bye,

Holger





View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957604#3957604

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957604



More information about the jboss-user mailing list