Reputation: 71
I use primefaces-5.1.jar and
javax.faces-2.2.0.jar(i got some error for
javax.faces-2.2.9.jar`)
Put this also in web.xml
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{Helper.theme}</param-value>
</context-param>
then i got error:
Error loading theme, cannot find "theme.css" resource of "primefaces-bootstrap" library
javax.faces.FacesException: Error loading theme, cannot find "theme.css" resource of "primefaces-bootstrap" library
at org.primefaces.renderkit.HeadRenderer.encodeTheme(HeadRenderer.java:134) ~[primefaces-5.1.jar:5.1]
at org.primefaces.renderkit.HeadRenderer.encodeBegin(HeadRenderer.java:81) ~[primefaces-5.1.jar:5.1]
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:869) ~[javax.faces-2.2.0.jar:2.2.0]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1854) ~[javax.faces-2.2.0.jar:2.2.0]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) ~[javax.faces-2.2.0.jar:2.2.0]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443) ~[javax.faces-2.2.0.jar:2.2.0]
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) ~[javax.faces-2.2.0.jar:2.2.0]
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) ~[javax.faces-2.2.0.jar:2.2.0]
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) ~[javax.faces-2.2.0.jar:2.2.0]
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) ~[javax.faces-2.2.0.jar:2.2.0]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) ~[javax.faces-2.2.0.jar:2.2.0]
But when i use javax.faces-2.1.25.jar
the error above is solved but get another error:
com.sun.faces.context.flash.ELFlash getCurrentFlashManager
SEVERE: JSF1094: Could not decode flash data from incoming cookie value Invalid characters in decrypted value. Processing will continue, but the flash is unavailable for this request.
My question is what compatible library for primefaces-5.1.jar
?
Thanks
Upvotes: 7
Views: 18472
Reputation: 5326
Put Primefaces Theme Maven dependecy into your pom.xml
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.8</version>
<scope>compile</scope>
</dependency>
Official documentation suggests use the 10.0.10 version of Primefaces themes, requesting add their own repository, which is not working properly and I was still receiving an error and this version of themes is not available in the Maven Central Repository.
After much research without an effective solution, I had need to opt to the last version of Maven repository whose is available only up to version 1.0.8. but my project still getting the following warning:
WARNING: JSF1064: Unable to find or serve resource, images/ui-bg_highlight-hard_70_000000_1x100.png, from library, primefaces-bootstrap.
WARNING: JSF1064: Não foi possível encontrar ou fornecer o recurso, images/ui-bg_highlight-hard_70_000000_1x100.png, pela biblioteca, primefaces-bootstrap.
Thinking a little bit I found a simple solution that solves the bootstrap theme problem.
The solution is :
background
of ui-widget-shadow css classSteps:
/resources/images/
)Use the following code:
.ui-widget-shadow {
background-image: url("images/ui-bg_highlight-hard_70_000000_1x100.png.jsf") !important;
}
That problem is discussed in:
Upvotes: 4
Reputation: 1387
Make sure that the dependency is well added in pom.xml (Add manually jar to maven local repository if this is premium theme, more info here)
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>{theme-name-here}</artifactId>
<version>{version-here}</version>
</dependency>
Add the correct configuration in web.xml for use this theme.
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{theme-name-here}</param-value>
</context-param>
I had a case where everything was set up correctly but the message "Error loading theme, cannot find “theme.css” resource of primefaces theme library" still appeared. I solved it:
This remove all cache files, works for me.
Upvotes: 1
Reputation: 1614
Add dependency to pom.xml
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.0</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>cupertino</artifactId>
<version>1.0.8</version>
</dependency>
Add configuration to web.xml
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{LayoutBean.applicationTheme}</param-value>
</context-param>
Create an application scoped eager bean to load when the JSF application loads
@ManagedBean(name = "LayoutBean", eager = true)
@ApplicationScoped
public class LayoutBean {
private String theme = "cupertino";
public String getApplicationTheme() {
return theme;
}
}
Upvotes: 2
Reputation: 57
Did you include only the primefaces jar or the themes as well? E.g. using maven you need a dependency for primefaces and a dependency for the theme or all themes. I forgot the latter and got the same exception. Have a look here (scroll down to "Installation"): Primefaces/Themes
Upvotes: 0
Reputation: 12337
All recent versions of themes in the primefaces maven repository are compatible with 5.1
Upvotes: 0