jsfbootsfaces

Problem with CSS loading in BootsFaces offline


I have a problem with a JSF Web Java project using Bootsfaces: the default library loads three files from the internet while I disconnected form internet

When the project is offline, it gives problems when loading the page for not finding these files. I already downloaded and put the dependencies on the pages that requires them although it still give problems when is offline to reason of been looking that files. BootsFaces is a JAR so it is unlikely that you can look up the call of those files. Is there any chance to eliminate the load of files at run time? In addition, it is even better for me to load the local files due to in slow connectivity moments it can slow down the site loading. This is a code fragment of the parent template:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:b="http://bootsfaces.net/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head>
<link rel="shortcut icon" type="image/x-icon" href="#{templateBean.request}/assets/admin/img/favicon.png"/>
        <link rel="stylesheet" href="#{templateBean.request}/assets/admin/css/datatable/datatables.min.css"/>
        <link rel="stylesheet" href="#{templateBean.request}/assets/admin/css/font-awesome/font-awesome.min.css"/>

        <!-- Bootstrap CSS -->
        <link rel="stylesheet" href="#{templateBean.request}/assets/admin/css/bootstrap.min.css"/>

After a recommendation to download the files with problems and use them locally with , and to have downloaded the latest version of bootsfaces (1.4.1) it was possible to reduce the problems to only 1 error: datatables.js.

At the beginning of the parent template I added these lines:

<h:outputStylesheet library="css" name="datatables.min.css"/>
<h:outputStylesheet library="css" name="font-awesome.min.css"/>
<h:outputScript library="js" name="datatables.min.js"/>

screenchot for files structure screenshot for the error during load page

In the image you can see how it is loading the local file but still looking for the internet and the load of the page is 19s.


Solution

  • Thanks to Stephan Rauh for the contribution. The solution you gave me worked perfectly. The solution is to modify the web.xml file and add these lines. You have to download and include the files that you try to download from the internet anyway.

    <context-param>
            <param-name>net.bootsfaces.get_datatable_from_cdn</param-name>
            <param-value>true</param-value>
    </context-param>