'PrimeFaces' is undefined error

Components, Ajax Framework, Utilities and More.
Post Reply
arvindpal05
Posts: 25
Joined: 30 Aug 2010, 07:56

30 Aug 2010, 08:02

HI,
I'm trying to use primefaces 2.1 with jsf 1.2. But when I load my jsp page I just get this javascript error: " 'PrimeFaces' is undefined " and when i am putting p:resources in f:view no error is coming but contents not displayed
Please suggest me what to do to come out this error

this is my jsp code
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://primefaces.prime.com.tr/ui" prefix="p"%>

<html>
<head>
<p:resources />
</head>
<body>
<f:view>

<h:form>
<p:commandButton></p:commandButton>

</h:form>

</f:view>
</body>
</html>

arvindpal05
Posts: 25
Joined: 30 Aug 2010, 07:56

30 Aug 2010, 08:44

this is my web.xml code.

<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_resource/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>com.sun.faces.allowTextChildren</param-name>
<param-value>true</param-value>
</context-param>

callahan
Posts: 768
Joined: 27 May 2010, 22:52

30 Aug 2010, 09:38

Hi,

PrimeFaces 2.1 is for JSF 2.0. For JSF 1.2 use PrimeFaces 1.1. Note that PrimeFaces is dropping support for JSF 1.2 and PrimeFaces 1.1 is the last release for JSF 1.2.

arvindpal05
Posts: 25
Joined: 30 Aug 2010, 07:56

30 Aug 2010, 11:47

Thanks for reply
i changed my application from jsf 1.2 to myfaces 2.0 now i am getting follwing exception while accessing jsp page

org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/sun/faces/taglib/jsf_core/ViewTag
Caused by:
java.lang.NoClassDefFoundError - com/sun/faces/taglib/jsf_core/ViewTag

list of jar files in lib folder
commons-beanutils-1.7.0.jar
commons-codec-1.3.jar
commons-collections-3.2.jar
commons-digester-1.8.jar
commons-discovery-0.4.jar
commons-logging-1.1.1.jar
myfaces-api-2.0.1.jar
myfaces-impl-2.0.1.jar
primefaces-2.1.jar

and my web.xml
<?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_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>Test</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<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>/faces/*</url-pattern>
</servlet-mapping>
<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_resource/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>faces</servlet-name>
<servlet-class>org.apache.myfaces.webapp.MyFacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>faces</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>faces</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
</web-app>


and my jsp page -
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://primefaces.prime.com.tr/ui" prefix="p"%>
<html>
<head>

</head>
<body>
<f:view>

<h:form>
<p:panel></p:panel>

</h:form>

</f:view>
</body>
</html>

please suggest me where is going wrong ?

thanks

arvindpal05
Posts: 25
Joined: 30 Aug 2010, 07:56

30 Aug 2010, 12:21

Hi,
above problem is resolved but still i am getting 'Primefacers' is undefined script error same application is working for facelets but when i am trying in jsp getting error please guide me if any additional setup or jar file required

Thanks

callahan
Posts: 768
Joined: 27 May 2010, 22:52

30 Aug 2010, 12:32

Hi,

Note that using jsp with PrimeFaces is not recommended. Now that you've switched to JSF 2.0, why don't you use facelets.

marco
Posts: 66
Joined: 14 Jun 2010, 17:25

30 Aug 2010, 13:30

As already stated: don't use JSP with JSF 2.0 as then JSF behaves in a backward compatibility mode and is not using any new features of JSF 2.0. Facelets is the technology to use.

And you HAVE to use <h:head> in JSF 2.0 as jsf needs it for the ressources!

arvindpal05
Posts: 25
Joined: 30 Aug 2010, 07:56

30 Aug 2010, 13:55

Hi,

Thanks for your suggestion and quick reply we want to use primefaces in our product and we have jsp files its very hard to convert all jsp files to Facelets (.xhtml) so there is no way to use primefaces in jsp ?

Thanks

marco
Posts: 66
Joined: 14 Jun 2010, 17:25

30 Aug 2010, 14:44

you can safely use JSF 1.2 with Primefaces 1.1 if you have no problem that both frameworks don't update anymore and you'll get no new features anymore. Don't know for sure about bugfixes, but no new features.

In JSF 2.0 with PF you can use JSP's only as a backward compatibility as facelets is the only and official technology to define JSF views.

arvindpal05
Posts: 25
Joined: 30 Aug 2010, 07:56

30 Aug 2010, 15:43

Thanks

Post Reply
  • Information
  • Who is online

    Users browsing this forum: wanderlucio and 3 guests