Search code examples
jsf-2font-awesome

How can I integrate Font Awesome 4.3.0 with JSF?


I've already tried this method:

How to use Font Awesome from webjars.org with JSF

It actually works great. The problem is that configuring the omnifaces UnmappedResourceHandler as a resource handler breaks one of my other JSF library components:

faces-config.xml:

<application>
    <resource-handler>org.omnifaces.resourcehandler.UnmappedResourceHandler</resource-handler>
</application>

When I try to use an ace:dataExporter (which I think is the same as a p:dataExporter)

webpage.xhtml: 

<ace:dataExporter target="dataTable" fileName="data" type="csv"/>  

Nothing gets exported and I get the following in my glassfish logs:

Warning: JSF1091: No mime type could be found for file s01a3dc15-c480-4769-a71a-bc08f191416f.  To resolve this, add a mime-type mapping to the applications web.xml.
Warning: JSF1091: No mime type could be found for file 71a-bc08f191416f.  To resolve this, add a mime-type mapping to the applications web.xml.

I'm open to any other suggestions to packaging font-awesome into my web application (I can't use the CDN version).


Solution

  • If you use the latest webjars font-awesome version, there is nothing to configure. Add the jar to your project, either via maven or directly and it just works. Just make sure you include the correct css

    <h:outputStylesheet library="webjars" name="font-awesome/4.3.0/css/font-awesome-jsf.css" />