Javascript warning: 'Primefaces' is undefined

UI Components for JSF
Post Reply
keizer
Posts: 3
Joined: 30 Aug 2010, 09:07

30 Aug 2010, 09:27

Hi,

I've got the following warning: 'PrimeFaces' is undefined and the backing bean method in the nodeSelectListener won't be called:
This problem only occurs in Internet Explorer 7.
Please can you help me?

This is my code:

Head:
<head>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<title>title</title>
<p:resources />
</head>

Ui-composition (xhtml):
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:p="http://primefaces.prime.com.tr/ui">
<ui:composition>
<a4j:region renderRegionOnly="true">
<a4j:outputPanel id="panel">
<a4j:status>
<f:facet name="start">
<h:graphicImage
url="#{facesContext.externalContext.requestContextPath}/images/loading.gif" />
</f:facet>
</a4j:status>
<ui:fragment rendered="#{detailBean.method}">
<h:form id="formid">
<p:tree value="#{detailBean.three}" var="node"
expanded="true" selectionMode="single"
selection="#{detailBean.selectedNode}"
nodeSelectListener="#{detailBean.onNodeSelect}"
onselectComplete="window.open('http://localhost:9081/project/pdf','mywindow');">
<p:treeNode>
<h:outputText value="#{node}" />
</p:treeNode>
<p:treeNode type="document">
<h:outputText value="#{node}" styleClass="documentStyle"/>
</p:treeNode>
</p:tree>
</h:form>
</ui:fragment>
</a4j:outputPanel>
<a4j:form>
<a4j:jsFunction name="loadPortal"
action="#{detailBean.loadPortlet}"
reRender="panel" />
</a4j:form>
</a4j:region>
</ui:composition>
</html>

I'm using primefaces-1.1.jar and Sun's JavaServer Faces implementation (1.2_07-b03-FCS) libaries.
Last edited by keizer on 31 Aug 2010, 12:01, edited 1 time in total.

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

30 Aug 2010, 11:29

you need to use <h:head> component as its necessary that JSF can add needed resources to the view.

As its missing all resources are not rendered in the output page and therefore the PF javascript libraries are missing and so is the 'Primefaces' variable.

keizer
Posts: 3
Joined: 30 Aug 2010, 09:07

31 Aug 2010, 12:02

Hello,

A little bit extra information:
I'm using primefaces-1.1.jar and Sun's JavaServer Faces implementation (1.2_07-b03-FCS) libaries.

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

31 Aug 2010, 12:05

Make sure you have Resource Servlet properly configured.

keizer
Posts: 3
Joined: 30 Aug 2010, 09:07

31 Aug 2010, 16:47

I will give some additional information:
The tree is being loaded, this provides no problems, only when I click on a node, the node Select Listener = "# (detailBean.onNodeSelect)" is not called.

Resource Servlet is precisely defined in the web.xml
<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>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests