JSF2 PrimeFaces Installaion
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</url>
<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>
开发者_Python百科 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?
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.
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.
I read the installation page and it seems that you need this to occur somewhere inside the <html>
tag:
<head>
<p:resources />
<head>
Make sure that you have an <h:head>
element in your page and not just <head>
since this is required by primefaces
精彩评论