首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Primefaces hello world

Primefaces hello world
EN

Stack Overflow用户
提问于 2014-11-16 05:50:28
回答 2查看 522关注 0票数 0

我正在尝试将primefaces集成到我的应用程序中,因此我遵循the primefaces user guide。我没有任何依赖关系的问题,但当进入指南的第一个示例时,除了一张空白页之外,我什么都没有得到。

代码语言:javascript
复制
<!DOCTYPE html>
<html xmlns="http://www.w3c.org/1999/xhtml" xmlns:p="http://primefaces.org/ui"><head id="j_idt2"></head><body>
    <p:editor></p:editor></body>
</html>

根据指南,我希望得到一个富文本编辑器,但却什么也没有显示。在我的html代码下面。你能看出来有什么错误吗?

代码语言:javascript
复制
<!DOCTYPE html>
<html xmlns="http://www.w3c.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui">
<h:head></h:head>
<h:body>
    <p:editor />
</h:body>
</html>

我已经添加了primefaces和myfaces作为依赖to my pom.xml

代码语言:javascript
复制
<dependencies>
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>5.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.myfaces.core</groupId>
        <artifactId>myfaces-api</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.myfaces.core</groupId>
        <artifactId>myfaces-impl</artifactId>
        <version>2.2.3</version>
    </dependency>
</dependencies>

web.xml中的配置似乎也很好:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">
    <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>
    <context-param>
        <param-name>primefaces.THEME</param-name>
        <param-value>bootstrap</param-value>
    </context-param>
</web-app>
EN

回答 2

Stack Overflow用户

发布于 2014-11-17 10:13:48

根据bootstrap主题需要bootstrap.jar,所以你的pom.xml应该是

代码语言:javascript
复制
<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>5.1</version>
    </dependency>
    <dependency>  
        <groupId>org.primefaces.themes</groupId>  
        <artifactId>bootstrap</artifactId>  
        <version>1.0.10</version>  
    </dependency> 
    <dependency>
        <groupId>org.apache.myfaces.core</groupId>
        <artifactId>myfaces-api</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.myfaces.core</groupId>
        <artifactId>myfaces-impl</artifactId>
        <version>2.2.3</version>
    </dependency>
</dependencies>
票数 0
EN

Stack Overflow用户

发布于 2014-11-18 03:18:34

你能添加h:form吗?

代码语言:javascript
复制
<!DOCTYPE html>
<html xmlns="http://www.w3c.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui">
<h:head></h:head>
<h:body>
<h:form>
    <p:editor />
</h:form>
</h:body>
</html>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26951119

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档