JSF2 PrimeFaces安装 [英] JSF2 PrimeFaces Installaion
问题描述
我想使用PrimeFaces.我按照网页
I would like to use PrimeFaces. I followed all the instructions on the webpage
我的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>
我猜只是正常!至少primefaces-2.0.0.jar
已下载!
Just works I guess! At least the primefaces-2.0.0.jar
has been downloaded!
下一个我的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>
我使用的是tomcat 6,到目前为止,我知道它不支持servlet 3.0,这就是为什么我必须添加servlet的原因.
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.
下一个我的xhtml代码:
<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?
推荐答案
如果不通过FacesServlet
的url-pattern
请求页面,则可能会发生这种情况.如果将其映射到例如*.jsf
,则需要确保您的请求URL与之匹配. IE.通过 http://example.com/context/page.jsf 打开页面,因此不能通过 http://examlpe.com/context/page.xhtml .
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.
如果这没有帮助,那么下一步是读取服务器日志中的任何错误或警告.另外,如果将<h:head>
和<h:body>
解析为<head>
和<body>
,则检查生成的HTML输出(右键单击浏览器,查看源代码)可能会提示FacesServlet
做得好不好.
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.
这篇关于JSF2 PrimeFaces安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!