1

For some reason my Primefaces is not rendering, i'm running with Eclipse and Tomcat.

As you can see on the image bellow, this is a test table with some fake data, and its not showing properly the table. If i change the <p:dataTable> to <h:dataTable> it works properly. As you can see too, there is an commandButton on the top without the primefaces theme for some reason.

Thank you guys!

Datatable

my ExpensesList.xhtml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:mp="http://primefaces.org/ui/material">

<h:form>
    <h:messages />
    <p:commandButton value="teste" />   
    <p:dataTable id="expenses" value="#{expensesController.dao.listAll()}" var="obj"
        frame="box" rules="all" cellpadding="8">

        <p:column headerText="Date">
            <f:facet name="header">Date</f:facet>
            <h:outputText value="#{obj.date}" />
        </p:column>
        <p:column headerText="costCenter">
            <h:outputText value="#{obj.costCenter}" />
        </p:column>
        <p:column headerText="Description">
            <h:outputText value="#{obj.description}" />
        </p:column>
        <p:column headerText="Diaria">
            <h:outputText value="#{obj.diaria}" />
        </p:column>
        <p:column headerText="KM">
            <h:outputText value="#{obj.km}" />
        </p:column>

    </p:dataTable>
</h:form>
</ui:composition>

My Web.xml:

 <?xml version="1.0" encoding="UTF-8"?>
<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">
 <display-name>rd</display-name>
 <context-param>
  <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
  <param-value>.xhtml</param-value>
 </context-param>
 <context-param>
  <param-name>javax.faces.PROJECT_STAGE</param-name>
  <param-value>Development</param-value>
 </context-param>
 <context-param>
  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  <param-value>client</param-value>
 </context-param>
 <context-param>
  <param-name>primefaces.FONT_AWESOME</param-name>
  <param-value>enable</param-value>
 </context-param>
 <context-param>
  <param-name>primefaces.THEME</param-name>
  <param-value>vader</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>
 <welcome-file-list>
  <welcome-file>index.jsf</welcome-file>
 </welcome-file-list>
</web-app>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • from this i can only advise you to check on your pom.xml to see if theres anything wrong or if you dont use maven, just insert the newest version of primefaces again and check if the declaration for the p namespace has no typeos – Master Azazel Aug 19 '16 at 12:53
  • Hello Azazel, thank you for your answer. I tried copying the pom.xml file from my last project that was fine and still not working. – Gustavo Chinaglia Aug 19 '16 at 12:54
  • try **rightclick on maven project** in eclipse and select **update project**, sometimes that helps, and please check if you have **xmlns:p="http://primefaces.org/ui"** exactly like that – Master Azazel Aug 19 '16 at 13:07
  • If i set **xmlns:p="primefaces.org/ui";** i got this message: **Warning: This page calls for XML namespace primefaces.org/ui declared with prefix p but no taglibrary exists for that namespace.**. with `xmlns:p="http://primefaces.org/ui"` no problem occurs but still not rendering properly – Gustavo Chinaglia Aug 19 '16 at 13:09
  • update your project, select everything but offline in the checkboxes menu that will appear, it will try updating and refreshing your dependencies. after that, reopen eclipse and see if it works.. did it work before in this project? – Master Azazel Aug 19 '16 at 13:13
  • Yes, and did again after you asked and still not working =( – Gustavo Chinaglia Aug 19 '16 at 13:15
  • idk, try a reboot, it wont hurt xD but we need some more information/code to make other guesses what could be wrong – Master Azazel Aug 19 '16 at 13:27
  • Added some code on the initial description, thank you! – Gustavo Chinaglia Aug 19 '16 at 13:37
  • if you get this error, the PrimeFaces jar is **not** in your deployed project – Kukeltje Aug 19 '16 at 13:51

1 Answers1

1

Trivial Mistake.

Added the <h:head></h:head> on the xhtml and on the pom.xml file added the all-themes for prime faces:

<repository>
        <id>prime-repo</id>
        <name>PrimeFaces Maven Repository</name>
        <url>http://repository.primefaces.org</url>
        <layout>default</layout>
</repository>

<dependency>
        <groupId>org.primefaces.themes</groupId>
        <artifactId>all-themes</artifactId>
        <version>1.0.10</version>
</dependency>