Primefaces not working with Richfaces

UI Components for JSF
Post Reply
mohanrajd
Posts: 2
Joined: 05 Apr 2010, 13:23

05 Apr 2010, 14:30

Hi Guys,

I am using JSF 2.0 and Richfaces 3.3.2 SR1 for a project. The list of library files used in my project are commons-beanutils-1.7.0.jar,commons-codec-1.4.jar,commons-collections-3.2.jar,commons-digester-1.8.jar,commons-discovery-0.4.jar,commons-fileupload14264.jar,commons-fileupload57779.jar,commons-io-1.3.1.jar,commons-logging-1.0.4.jar,darkX-3.3.2.SR1.jar,jdom.jar,jdom-b10.jar,jhighlight-1.0.jar,jsf-api.jar,jsf-facelets.jar,jsf-impl.jar,richfaces-api-3.3.2.SR1.jar,richfaces-impl-3.3.2.SR1.jar and richfaces-ui-3.3.2.SR1.jar. With this jars, my project is working fine using richfaces. If i add, primefaces-2.0.0.jar and lines such as

Code: Select all

<servlet>
        <servlet-name>Resource Servlet</servlet-name>
        <servlet-class>
            org.primefaces.resource.ResourceServlet
        </servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Resource Servlet</servlet-name>
        <url-pattern>/primefaces_resources/*</url-pattern>
    </servlet-mapping> 
to my project. Richfaces UI components are working fine but primefaces UI component are invisible and not working. Please suggest a solution for me. I like to use primefaces along with richfaces.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

05 Apr 2010, 18:30

You cannot use PrimeFaces2 and JSF 2with RichFaces 3.x as RichFaces 3.x does not support JSF2's facelets. You need to wait for RichFaces 4.x for that.

See: http://community.jboss.org/wiki/RichFaces333andJSF20

Also you got the resource servlet url pattern wrong, it should be primefaces_resource

PRIYABRATA05
Posts: 3
Joined: 05 Apr 2010, 14:03

06 Apr 2010, 07:56

I am trying to integrate Spring Webflow(2.0.8 ), richfaces(3.3.2.SR1) and Primefaces(1.0.1-SNAPSHOT). The richfaces components show up fine but the primeface components do not show up. I only get the text output or partial rendering of compoenets. For calender the textfield shows up but no calender icon( shows broken link ).. the command button show up fine. Any suggestions what could be the problem

web.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5">



	<!-- Java Server Faces Servlet -->

	<listener>
		<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
	</listener>
	
	<servlet>
		<servlet-name>JSF</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	
	<servlet-mapping>
		<servlet-name>JSF</servlet-name>
		<url-pattern>*.jsf</url-pattern>
	</servlet-mapping>
	
	<context-param>
		<param-name>javax.faces.CONFIG_FILES</param-name>
		<param-value>/WEB-INF/faces-application.xml,/WEB-INF/faces-bean.xml,/WEB-INF/faces-navigation.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>com.sun.faces.expressionFactory</param-name>
		<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
	</context-param>
	
	<context-param>
		<param-name>org.richfaces.SKIN</param-name>
		<param-value>blueSky</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.ajax4jsf.VIEW_HANDLERS</param-name>
		<param-value>com.sun.facelets.FaceletViewHandler</param-value>
	</context-param>
	
	<filter>
		<display-name>RichFaces Filter</display-name>
		<filter-name>richfaces</filter-name>
		<filter-class>org.ajax4jsf.Filter</filter-class>
	</filter>
	
	<filter-mapping>
		<filter-name>richfaces</filter-name>
		<servlet-name>JSF</servlet-name>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
	</filter-mapping>
	
	<filter-mapping>
		<filter-name>richfaces</filter-name>
		<servlet-name>Spring Dispatcher Servlet</servlet-name>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
	</filter-mapping>




	<context-param>
		<param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
		<param-value>resource/</param-value>
	</context-param><!--
	
	<context-param>
		<param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
		<param-value>true</param-value>
	</context-param>
	--><listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath*:**/*context.xml</param-value>
	</context-param>
	<servlet>
		<servlet-name>Spring Dispatcher Servlet</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value></param-value>
		</init-param>
		<load-on-startup>2</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>Spring Dispatcher Servlet</servlet-name>
		<url-pattern>/spring/*</url-pattern>
	</servlet-mapping>
	<servlet>
		<servlet-name>Resources Servlet</servlet-name>
		<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
		<load-on-startup>0</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>Resources Servlet</servlet-name>
		<url-pattern>/resources/*</url-pattern>
	</servlet-mapping>
	<context-param>
		<param-name>facelets.DEVELOPMENT</param-name>
		<param-value>true</param-value>
	</context-param>

	<!-- Configuration part for the Primefaces-->

	<servlet>
		<servlet-name>Resource Servlet</servlet-name>
		<servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>Resource Servlet</servlet-name>
		<url-pattern>/primefaces_resources/*</url-pattern>
	</servlet-mapping>

	<!-- End of the configuration part for the Primefaces-->
</web-app>

TestPage.xhtml

Code: Select all

<html xmlns="http://www.w3c.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui">
<head>
<p:resources/>
</head>
<body>

<p:editor />

<p:calendar id="cal" />

<h:form><p:commandButton value="Submit" ></p:commandButton></h:form>

<p><p:layout style="width:400px;height:200px;">
	<p:layoutUnit position="west" size="100">Left Pane</p:layoutUnit>
	<p:layoutUnit position="center">Right Pane</p:layoutUnit>
</p:layout></p>

</body>

</html>

mohanrajd
Posts: 2
Joined: 05 Apr 2010, 13:23

06 Apr 2010, 10:17

Now primefaces working fine for me after using Richfaces 4.0.0 Alpha1 library. but i don't how to define tag library for richfaces. In the old version i use to define as

Code: Select all

xmlns:rich="http://richfaces.org/a4j
. But in richfaces 4.0.0, its not working. After checking the sample source code of richfaces, the taglib has been defined as

Code: Select all

xmlns:rich="http://java.sun.com/jsf/composite/rich"
. Again this is also not working. It shows errors as "No library found for this namespace".

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

06 Apr 2010, 14:40

You might ask that particular question in RichFaces forum.

PRIYABRATA05
Posts: 3
Joined: 05 Apr 2010, 14:03

06 Apr 2010, 17:07

Any comments on my problem ?... Have been stuck for two days on it

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

06 Apr 2010, 17:37

Try;

Code: Select all

<url-pattern>/primefaces_resource/*</url-pattern>

PRIYABRATA05
Posts: 3
Joined: 05 Apr 2010, 14:03

07 Apr 2010, 07:42

Oops.. How stupid of me to miss that .. It's working great now... Thanks for pointing that out..
How ever I have a different problem now. While trying to use the tree component with the Spring webflow i get an exception because the TreeNode class in primifaces is not serializable, while webflow requires all beans in the flow scope to be serializable. One workaround was to make the TreeNode and selectedTreeNodes variable in the TreeBean class transient and store tree related state and data in a separate data-structure and reconstruct the root treenode everytime a request for the root node or selected node is made.. However I guess its a very expensive process. This was the only thing i could think of now. I would appreciate if you could suggest for a better solution to the problem?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Apr 2010, 10:37

Please create a ticket for that in our issue tracker and we'll fix it asap.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests