title: Primefaces theme configuration
body: <p>I am studying primefaces themes on Primefaces user guide.
  <a href="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/primefaces/primefaces_users_guide_3_3.pdf" rel="nofollow noreferrer">https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/primefaces/primefaces_users_guide_3_3.pdf</a> At pag. 457 you can read: "Once you've downloaded the theme, configure PrimeFaces to use it</p>
  
  <pre><code>&lt;context-param&gt;
  
      &lt;param-name&gt;primefaces.THEME&lt;/param-name&gt;
  
      &lt;param-value&gt;aristo&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p>Where should I put it? Into the webpage file I am developing?
  I choosed the jar file of Redmond theme and I imported it into my Eclipse Dynamic web project, but I don't see any improvement.</p>
  
  <p>The Primefaces example I am testing is: <a href="https://www.primefaces.org/showcase/ui/data/datatable/basic.xhtml" rel="nofollow noreferrer">https://www.primefaces.org/showcase/ui/data/datatable/basic.xhtml</a></p>
  
  <p><strong>Car.java</strong></p>
  
  <pre><code>import java.util.Date;
  
  public class Car {
  
          private String model;
          private int year;
          private String manufacturer;
          private String color;
  
          public Car(String model, int year, String manufacturer, String color) {
                  this.model = model;
                  this.year = year;
                  this.manufacturer = manufacturer;
                  this.color = color;
          }
  
          public String getModel() {
                  return model;
          }
  
          public void setModel(String model) {
                  this.model = model;
          }
  
          public int getYear() {
                  return year;
          }
  
          public void setYear(int year) {
                  this.year = year;
          }
  
          public String getManufacturer() {
                  return manufacturer;
          }
  
          public void setManufacturer(String manufacturer) {
                  this.manufacturer = manufacturer;
          }
  
          public String getColor() {
                  return color;
          }
  
          public void setColor(String color) {
                  this.color = color;
          }
  }
  </code></pre>
  
  <p><strong>TableBean.java</strong></p>
  
  <pre><code>package classi;
  
  import java.io.Serializable;  
  import java.util.ArrayList;  
  import java.util.List;  
  import java.util.UUID;  
  import javax.faces.application.FacesMessage;
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  import javax.faces.context.FacesContext;
  import javax.faces.event.ActionEvent;
  import org.primefaces.context.RequestContext;
  
  
  @ManagedBean(name="tableBean")
  @SessionScoped
  public class TableBean implements Serializable
  {  
      private final static String[] colors;  
  
      private final static String[] manufacturers;  
  
      private List&lt;Car&gt; carsSmall;  
      static {  
          colors = new String[10];  
          colors[0] = "Black";  
          colors[1] = "White";  
          colors[2] = "Green";  
          colors[3] = "Red";  
          colors[4] = "Blue";  
          colors[5] = "Orange";  
          colors[6] = "Silver";  
          colors[7] = "Yellow";  
          colors[8] = "Brown";  
          colors[9] = "Maroon";  
  
          manufacturers = new String[10];  
          manufacturers[0] = "Mercedes";  
          manufacturers[1] = "BMW";  
          manufacturers[2] = "Volvo";  
          manufacturers[3] = "Audi";  
          manufacturers[4] = "Renault";  
          manufacturers[5] = "Opel";  
          manufacturers[6] = "Volkswagen";  
          manufacturers[7] = "Chrysler";  
          manufacturers[8] = "Ferrari";  
          manufacturers[9] = "Ford";  
      }  
  
  
  
      public TableBean() {  
          carsSmall = new ArrayList&lt;Car&gt;();  
  
          populateRandomCars(carsSmall, 9);  
      }  
  
      private void populateRandomCars(List&lt;Car&gt; list, int size) {  
          for(int i = 0 ; i &lt; size ; i++)  
              list.add(new Car(getRandomModel(), getRandomYear(), getRandomManufacturer(), getRandomColor()));  
      }  
  
      public List&lt;Car&gt; getCarsSmall() {  
          return carsSmall;  
      }  
  
      private int getRandomYear() {  
          return (int) (Math.random() * 50 + 1960);  
      }  
  
      private String getRandomColor() {  
          return colors[(int) (Math.random() * 10)];  
      }  
  
      private String getRandomManufacturer() {  
          return manufacturers[(int) (Math.random() * 10)];  
      }  
  
      private String getRandomModel() {  
          return UUID.randomUUID().toString().substring(0, 8);  
      }  
  } 
  </code></pre>
  
  <p><strong>table.xhtml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:p="http://primefaces.org/ui"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h:form&gt;  
      &lt;p:dataTable var="car" value="#{tableBean.carsSmall}"&gt;  
          &lt;p:column headerText="Model"&gt;  
              &lt;h:outputText value="#{car.model}" /&gt;  
          &lt;/p:column&gt;  
  
          &lt;p:column headerText="Year"&gt;  
              &lt;h:outputText value="#{car.year}" /&gt;  
          &lt;/p:column&gt;  
  
          &lt;p:column headerText="Manufacturer"&gt;  
              &lt;h:outputText value="#{car.manufacturer}" /&gt;  
          &lt;/p:column&gt;  
  
          &lt;p:column headerText="Color"&gt;  
              &lt;h:outputText value="#{car.color}" /&gt;  
          &lt;/p:column&gt;  
      &lt;/p:dataTable&gt;  
  &lt;/h:form&gt;  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"&gt;
    &lt;display-name&gt;PrimeFaces_DataTable&lt;/display-name&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;javax.servlet.jsp.jstl.fmt.localizationContext&lt;/param-name&gt;
      &lt;param-value&gt;resources.application&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;description&gt;State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2&lt;/description&gt;
      &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
      &lt;param-value&gt;client&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;primefaces.THEME&lt;/param-name&gt;
      &lt;param-value&gt;redmond&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;description&gt;
      This parameter tells MyFaces if javascript code should be allowed in
      the rendered HTML output.
      If javascript is allowed, command_link anchors will have javascript code
      that submits the corresponding form.
      If javascript is not allowed, the state saving info and nested parameters
      will be added as url parameters.
      Default is 'true'&lt;/description&gt;
      &lt;param-name&gt;org.apache.myfaces.ALLOW_JAVASCRIPT&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;description&gt;
      If true, rendered HTML code will be formatted, so that it is 'human-readable'
      i.e. additional line separators and whitespace will be written, that do not
      influence the HTML code.
      Default is 'true'&lt;/description&gt;
      &lt;param-name&gt;org.apache.myfaces.PRETTY_HTML&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;org.apache.myfaces.DETECT_JAVASCRIPT&lt;/param-name&gt;
      &lt;param-value&gt;false&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;description&gt;
      If true, a javascript function will be rendered that is able to restore the
      former vertical scroll on every request. Convenient feature if you have pages
      with long lists and you do not want the browser page to always jump to the top
      if you trigger a link or button action that stays on the same page.
      Default is 'false'
  &lt;/description&gt;
      &lt;param-name&gt;org.apache.myfaces.AUTO_SCROLL&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;listener&gt;
      &lt;listener-class&gt;org.apache.myfaces.webapp.StartupServletContextListener&lt;/listener-class&gt;
    &lt;/listener&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong>Screenshot of project structure</strong>
  <a href="https://i.imgur.com/tgrMH.png" rel="nofollow noreferrer">http://i.imgur.com/tgrMH.png</a></p>