For a university project I am using a skeleton project running PrimeFaces 6.2 on a Maven Web Application with Spring Boot. By default, this project applies the aristo style.
I have tried to change this by following the instructions at https://www.primefaces.org/themes/.
Added PrimeFaces Repository to pom.xml
<repository> <id>prime-repo</id> <name>PrimeFaces Maven Repository</name> <url>http://repository.primefaces.org</url> <layout>default</layout> </repository>
Added dependency to the all-themes file in pom.xml
<dependency> <groupId>org.primefaces.themes</groupId> <artifactId>all-themes</artifactId> <version>1.0.10</version> </dependency>
Added context-param to src/main/webapp/WEB-INF/web.xml
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>cruze</param-value>
</context-param>
However, the value at the web.xml gets ignored completely. Other values from this web.xml are used, however no matter what I put into the primefaces.THEME param, it will not be used. Even completely random values are accepted by the program and it will run just fine. Same with putting 'none', the same style is used still.
I have tried some solutions to similiar questions that haven't worked.
- Using a jar file instead of the pom.xml dependency - This does not affect anything since the value just gets ignored in the first place.
- My faces-config is not using a render kit, so this is not helping either.
- Using h:head - This is already the case.
- Using the xmlns:p="http://primefaces.org/ui" attribute in the html tag - Also already the case.
- The web.xml is of version 2.5, so the context-param syntax should be valid.
Is there any chance PrimeFaces is expecting the theme at a different place other than web.xml?
Addition: My problem is the same as described here. I am pretty certain it is using the same skeleton project, except on a newer PrimeFaces version.
Full web.xml file (tested with different primefaces.THEME values)
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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_2_5.xsd"
version="2.5">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<error-page>
<exception-type>org.springframework.security.access.AccessDeniedException</exception-type>
<location>/error/access_denied.xhtml</location>
</error-page>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>none</param-value>
</context-param>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>login.xhtml</welcome-file>
</welcome-file-list>
</web-app>
#{facesContext.externalContext.getInitParameter('primefaces.THEME')}
output? – Selaron