使用5.x和PrimeFaces 6.2+;
我在检查这个问题: 关于这个问题: 带着它的答案 嗨,我想使用5.5版的新图标 在我的使用5.x和PrimeFaces 6.2+;,primefaces,icons,font-awesome,Primefaces,Icons,Font Awesome,我在检查这个问题: 关于这个问题: 带着它的答案 嗨,我想使用5.5版的新图标 在我的pom.xml文件项目中 <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>6.2</version> </dependenc
pom.xml
文件项目中
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>primefaces-extensions</artifactId>
<version>6.2</version>
</dependency>
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.webjars/font-awesome -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
<version>5.5.0</version>
</dependency>
在我的facelet.xhtml中
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="/templates/template.xhtml">
<ui:define name="body">
<h:outputScript library="webjars" name="font-awesome/5.5.0/js/all.js"/>
...
<p:spacer width="10"/>6
<h:outputText styleClass="fas fas-map"/>7
<h:outputText styleClass="fa fa-venus-mars fa-icon-custom" />
<h:outputText styleClass="fa fa-female fa-icon-custom" />
<h:outputText styleClass="fa fa-male fa-icon-custom" />
...
6.
7.
注意:我使用的是fas
和fa
,但两者都不起作用
如图所示,所有图标均出现故障
如何解决这个问题?PF 6.2.12和PF 6.3中增加了使用FONT5的功能。查看此票证并提交,其中添加了以下功能: 在web.xml中关闭默认PF支持:
primefaces.FONT\u太棒了
假的
更新pom.xml
org.webjars
.首先从web.xml中删除与PrimeFaces相关的配置,制作一个没有模板的示例并检查结果是否正常。然后从问题中删除它,它不相关。。。请做一个…我在问题中放在这里,因为我在使用另一个答案,我在用false
值测试primefaces.FONT\u AWESOME
。与相关问题一样,并非所有代码都是必需的。不需要的代码不应出现在问题中。它会让人们困惑,让他们花时间在无关的评论上。我想我在这里读到了一些东西(希望如此)PF正在/正在放弃对FA的内置支持,并建议使用webjars解决方案。您在未来的版本中是正确的,他们正在放弃它以支持webjars,但是如果人们想在他们的项目中开始使用FA 5,这些样式现在正在添加。这只是一个无用的评论,说上面的解决方案有效,因为它没有反馈。我使用的primefaces 6.1和FA 5仍然有效。不幸的是,根据这个答案进行更改对我不起作用。我认为name=“font awesome/VERSION\u font\u awesome/css/all.min jsf.css”
必须符合pom.xml中声明的font awesome VERSION\u font\u awesome
当您升级到fontawesome 5.5时,并不是所有图标都是“fa XXX”,有些现在是“fas XXX”和FAR、FAL、FAB。见本页:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="/templates/template.xhtml">
<ui:define name="body">
<h:outputScript library="webjars" name="font-awesome/5.5.0/js/all.js"/>
...
<p:spacer width="10"/>6
<h:outputText styleClass="fas fas-map"/>7
<h:outputText styleClass="fa fa-venus-mars fa-icon-custom" />
<h:outputText styleClass="fa fa-female fa-icon-custom" />
<h:outputText styleClass="fa fa-male fa-icon-custom" />