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
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:
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;
}
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With