1

I am trying to display a simple webpage using Primefaces, cupertino theme. However, the page does not display anything when run on server.

Here is my index.html page

`<?xml version = "1.0" encoding = "UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:p="http://primefaces.org/ui">

<h:head>
</h:head>

<h:body>
    <p:layout fullPage="true">
        <p:layoutUnit position="north" size="50">
            <h:outputText value="Top content." />
        </p:layoutUnit>
        <p:layoutUnit position="south" size="100">
            <h:outputText value="Bottom content." />
        </p:layoutUnit>
        <p:layoutUnit position="west" size="300">
            <h:outputText value="Left content" />
        </p:layoutUnit>
        <p:layoutUnit position="east" size="200">
            <h:outputText value="Right Content" />
        </p:layoutUnit>
        <p:layoutUnit position="center">
            <h:outputText value="Center Content" />
        </p:layoutUnit>
    </p:layout>

</h:body>
</html>`

and here is my web.xml

`<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
  <display-name>Connection_Application</display-name>
  <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
  <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>/faces/*</url-pattern>
  </servlet-mapping>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <context-param>
        <param-name>primefaces.THEME</param-name>
        <param-value>cupertino</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.FONT_AWESOME</param-name>
        <param-value>true</param-value>
    </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
</web-app>`

Can you please let me know if I am missing something.

Thanks in advance

Tried a simple datatable too, but did not work.

Nikhil G
  • 31
  • 2

2 Answers2

1

First of all, I don't know what version of PrimeFaces you are using, but the Cupertino theme is considered legacy since PrimeFaces version 10. Legacy themes are not compatible with newer version of PrimeFaces.

Assuming you are using a compatible PrimeFaces version, you should make sure you add the theme dependency to your project. As you titled your question as non-Maven, you should download the JAR and add it to your project manually.

See also: Why do I need PrimeFaces Maven Repository to use a theme?

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
1

The Cupertino theme is not part of the core PrimeFaces jar. You need to add the PrimeFaces Cupertino Theme. If you need all themes, add All Themes to your class path (WEB-INF/lib in the war file).

seenukarthi
  • 8,241
  • 10
  • 47
  • 68