Quando use EL dentro do web.xml eu recebo a seguinte mensagem de erro:
HTTP Status 500 - Error loading css, cannot find "theme.css" resource of "primefaces-" library
type Exception report
message Error loading css, cannot find "theme.css" resource of "primefaces-" library
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error loading css, cannot find "theme.css" resource of "primefaces-" library
javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
javax.faces.FacesException: Error loading css, cannot find "theme.css" resource of "primefaces-" library
org.primefaces.renderkit.HeadRenderer.encodeCSS(HeadRenderer.java:139)
org.primefaces.renderkit.HeadRenderer.encodeBegin(HeadRenderer.java:76)
javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:865)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1854)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.30 logs.
Apache Tomcat/8.0.30
Meu web.xml e minha classe TemaBean.java seguem abaixo:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<display-name>livraria</display-name>
<!-- Configuração do JSF -->
<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>
<!-- Definição do thema no Primefaces -->
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{temaBean.tema}</param-value>
</context-param>
</web-app>
package br.com.caelum.livraria.bean;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean
@SessionScoped
public class TemaBean implements Serializable {
private static final long serialVersionUID = 1L;
private String tema = "blitzer"; // "pepper-grinder";
public String getTema() {
return tema;
}
public void setTema(String tema) {
this.tema = tema;
}
public List getTemas() {
return Arrays.asList( "afterdark", "afternoon", "afterwork", "black-tie", "blitzer", "bluesky", "bootstrap", "casablanca", "cruze", "cupertino", "dark-hive",
"delta", "dot-luv", "eggplant", "excite-bike", "flick", "glass-x","home", "hot-sneaks", "humanity", "le-frog",
"midnight", "mint-choc", "overcast", "pepper-grinder", "redmond", "rocket", "sam", "smoothness",
"south-street", "start", "sunny", "swanky-purse", "trontastic", "ui-darkness", "ui-lightness", "vader");
}
}