Component render problem

UI Components for JSF
kaczortrex
Posts: 9
Joined: 23 Aug 2010, 21:00

25 Aug 2010, 15:33

Hi guys I'm trying to get started with PF instead of Richfaces.
I think I've written all the necessary code like p:resource, f:view, some web.xml configuration (based on forum topics) and maven dependencies


index.xhtml

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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:p="http://primefaces.prime.com.tr/ui">  
  	<f:view contentType="text/html">
    <head>  
  	<p:resources />
    </head>  
      
    <body>  
    
    <h:form>
    test
    	<p:editor value="" width="640px" height="320px"></p:editor>
    	<p:gmap center="41.381542, 2.122893" zoom="15" type="HYBRID" style="width:600px;height:400px" />
    	</h:form>
        
    </body>  
    </f:view>
</html>  

web.xml

Code: Select all

?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
	<context-param>
		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
		<param-value>server</param-value>
	</context-param>

	<context-param>
		<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
		<param-value>.xhtml</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>
	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>*.jsf</url-pattern>
	</servlet-mapping>
	<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>
	<welcome-file-list>
		<welcome-file>faces/index.xhtml</welcome-file>
	</welcome-file-list>
</web-app>


pom.xml part

Code: Select all

	<repositories>
		<repository>
			<id>prime-repo</id>
			<name>Prime Technology Maven Repository</name>
			<url>http://repository.prime.com.tr</url>
			<layout>default</layout>
		</repository>
	</repositories>
	<dependencies>
		<dependency>
			<groupId>org.jboss.spec</groupId>
			<artifactId>jboss-javaee-6.0</artifactId>
			<version>1.0.0.Beta7</version>
			<type>pom</type>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate</artifactId>
			<version>3.5.0-Final</version>
			<type>pom</type>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>2.2.M1-SNAPSHOT</version>
		</dependency>
	</dependencies>
My problem is that no component is rendered. I would be gratefull if You can check it and give me some tips.

Greetings :)

Btw my configuration: Eclipse Helios with Glassfish plugin, Glassfishv3, Primefaces 2.2.M1-Snapshot
Browsers: Opera, Firefox, Chrome - all up to date.

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

25 Aug 2010, 16:05

Welcome to PrimeFaces!

You need to use h:head instead of head, see;

http://www.primefaces.org/gettingStarted.html

kaczortrex
Posts: 9
Joined: 23 Aug 2010, 21:00

25 Aug 2010, 16:14

Hi Optimus - it's still not working- I changed body and head to h:head/h:body


I have no idea what could be wrong now

Btw in GettingStarted in Test Run part <head> is missing closing tag (double <head>, not <head></head>)

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

25 Aug 2010, 17:27

Can you check the generated html, what do you have in head section?

kaczortrex
Posts: 9
Joined: 23 Aug 2010, 21:00

25 Aug 2010, 17:40

Of course - code paste of generated index.xhtml

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.prime.com.tr/ui"><head>  
  	<p:resources></p:resources></head><body>
<form id="j_idt8" name="j_idt8" method="post" action="/jdashboard/faces/index.xhtml" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt8" value="j_idt8" />

    test
    	<p:editor width="640px" height="320px"></p:editor>
    	<p:gmap center="41.381542, 2.122893" zoom="15" type="HYBRID" style="width:600px;height:400px"></p:gmap><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="6910789577131308564:958664070942704607" autocomplete="off" />
</form></body>
</html>

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

26 Aug 2010, 00:03

You are not making a faces request, make sure you invoke faces servlet.

kaczortrex
Posts: 9
Joined: 23 Aug 2010, 21:00

26 Aug 2010, 16:43

It's not problem with Faces Servlet I think - I was wondering if it could work on jsp way, and then I realized that Glassfish has problem with finding PF library in classpath (I created jsf2.0 project with netbeans and then included PF library through NB, and it started "out-of-the-box").
In eclipse i used downloaded jar in case of maven dependency, and it didn't work yet, so I included PF jar into Glassfish lib folder - now it's working.

It seems like PF need a mysql-connector-like way, or just my eclipse going crazy.
Last edited by kaczortrex on 26 Aug 2010, 20:58, edited 2 times in total.

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

26 Aug 2010, 19:37

PF does not need a mysql connector :)

Do you have a working JSF application, please make sure you have one so we can discuss PrimeFaces setup.

kaczortrex
Posts: 9
Joined: 23 Aug 2010, 21:00

26 Aug 2010, 19:43

PF does not need a mysql connector
Yes, I know :) I mean it looks like Glassfish wants PF jar inside it's lib folder - just like using mysql-connector :)

P.S I will create new project under Netbeans and Eclipse, then configure it and we will see what's wrong (i guess ;) )

kaczortrex
Posts: 9
Joined: 23 Aug 2010, 21:00

26 Aug 2010, 20:22

Ok - I cleaned up Glassfish lib folder, updated NB to 6.9.1, created new web project (with defaults+facelets/jsf2.0), added PF and PF-sources jars (2.2.M1-Snapshot), inserted p:editor in index.xhtml - and it finally works.

Now I will try something similar with Eclipse

EDiT:

I imported files from NB project to Eclipse project, then had long fight with cleaning Glasfish deploy information (I don't know but Glassfish + Eclipse under Windows aren't good combination - it has problems about cleaning and deploying in some situations, and when it comes you need at least few restarts and cleaning from administartion console), and finally it works in Eclipse - I see PF editor.

I could swear, that present data in index.xhtml and web.xml descriptor and of course included libraries, and project capabilities are the same as few hours ago, but now it works, and this is the most important.

Tip of a day: The easiest way is the best way ;]

Thank You optimus.prime for your time, I'm gratefull for your help
Last edited by kaczortrex on 26 Aug 2010, 20:58, edited 3 times in total.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 36 guests