views:

264

answers:

3

I would like to use PrimeFaces. I followed all the instructions on the webpage

My POM:

<dependency>  
    <groupId>org.primefaces</groupId>  
    <artifactId>primefaces</artifactId>  
    <version>2.0.0</version>  
</dependency> 

[...]

<repository>  
    <id>prime-repo</id>  
    <name>Prime Technology Maven Repository</name>  
    <url>http://repository.prime.com.tr&lt;/url&gt;  
    <layout>default</layout>  
</repository> 

Just works I guess! At least the primefaces-2.0.0.jar has been downloaded!

Next my web.xml:

  <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>*.xhtml</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>   

I use tomcat 6 and so far I know it doesn't support servlet 3.0 that's why I have to add a servlet.

Next my xhtml codes:

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.prime.com.tr/ui" >
    [...]
    <p:editor value="#{projectData.description}" width="640px" height="320px"></p:editor> 

So far, it's not being rendered. Where is my mistake?

A: 

I read the installation page and it seems that you need this to occur somewhere inside the <html> tag:

     <head>  
         <p:resources />  
     <head>
amphetamachine
Thank you. But I am using JSF2 and the installation page says: 'If you're using PrimeFaces 2.x with JSF you can skip this section as native JSF2 apis are used in this case.' But anyways I tried it and it doesn't solve the problem.
Sven
+1  A: 

Tomcat is a simple servlet container, and doesn't contain JSF2 jars. Primefaces is just a component suite on top of the base JSF2 installation (could be Sun's RI: Mojarra, or Myfaces). First you have to download and configure either of those, and then Primefaces will work.

Gabor Kulcsar
I know and I did that already, thank you
Sven
+1  A: 

This can happen if you don't request the page through the url-pattern of the FacesServlet. If it is mapped on for example*.jsf, then you need to ensure that your request URL matches it. I.e. open the page by http://example.com/context/page.jsf and thus not by http://examlpe.com/context/page.xhtml.

If that doesn't help, then the firstnext step is to read the server logs for any errors or warnings. Also, checking the generated HTML output (rightclick browser, View Source) if the <h:head> and <h:body> are been parsed into <head> and <body> may give hints about if the FacesServlet is doing its job well or not.

BalusC
I am not sure I have got what you meant. I posted my FacesServlet declaration, so you can take a look. I request the page through the url-pattern (I think)
Sven
Check server logs and HTML output, see answer update.
BalusC