Problem with primefaces and facelets

UI Components for JSF
Post Reply
gandalf7170
Posts: 2
Joined: 08 Jul 2010, 15:05

08 Jul 2010, 15:15

Hi

I'm trying to port an IceFaces to primefaces, because there are some interesting components that I was missing in IceFaces. However, I'm facing quite a number of problems doing very simple tests:

The following code is working:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<f:view>
	<head>
	<title>Test Page</title>
	<meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
	<p:resources />
	</head>

	<body>
	<h:form>
		<p:editor></p:editor>
	</h:form>
	</body>
</f:view>
</html>
However, when I try to do the same with facelets, I always get a NullPointerException; if I use a non-primefaces tag in the ui:define, then it works; but whatever primefaces tag I use, I get the setProperties method on that tag throwing an exception. I also tried with and without the <p:resources/> in the head section, it doesn't change anything

I'm running on OS X, with Tomcat 6.0.26

Any help appreciated, since this is really a stopper for me

Regards

Jean-Noel

entry2.jspx

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<ui:composition 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:p="http://primefaces.prime.com.tr/ui"
	template="/layout/template2.jspx">

	<ui:define name="mainbody">
		<p:editor></p:editor>
	</ui:define>
</ui:composition>
template2.jspx

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<f:view>
	<h:head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title><ui:insert name="title">...</ui:insert></title>
		<p:resources />
	</h:head>

	<h:body>
		<h:form id="form">
			<ui:insert name="mainbody">...</ui:insert>
		</h:form>
	</h:body>
</f:view>
</html>
The stacktrace:

Code: Select all

java.lang.NullPointerException
	org.primefaces.component.editor.EditorTag.setProperties(EditorTag.java:67)
	javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:614)
	javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1142)
	org.apache.jsp.entry.entry2_jspx._jspx_meth_p_005feditor_005f0(entry2_jspx.java:86)
	org.apache.jsp.entry.entry2_jspx._jspService(entry2_jspx.java:60)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)

User avatar
michiel
Posts: 240
Joined: 07 Jun 2010, 09:12
Location: Belgium

08 Jul 2010, 15:59

have you tried <p:editor /> instead of <p:editor></p:editor>,
some browsers can't handle empty tags
JSF-2.0, mojarra-2.0.2-FCS and PrimeFaces-2.1 on GlassFish v3.0.1 (build 22)

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

08 Jul 2010, 15:59

Hi,

Welcome to PrimeFaces.

I think you are missing FaceletViewHandler configuration in faces-config.xml.

Code: Select all

<faces-config>
    <application>
        <!-- Enables Facelets -->
        <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>  
    </application>
</faces-config>

gandalf7170
Posts: 2
Joined: 08 Jul 2010, 15:05

08 Jul 2010, 16:06

Excellent, that was it!

Thanks for the very prompt support

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

08 Jul 2010, 16:09

Welcome to PrimeFaces Community!

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 61 guests